2013-09-28 3 views
0

오케이,이 내용을 간략하게 알려 드리겠습니다.DataTables JSON 구문 분석 오류 - 액세스가 거부되었습니다.

http://www.hunterpdx.com/metro_new_copy/view-reports-test.php에서 오류를 볼 수 있습니다. 나는이 너무 많이 읽고

DataTables warning (table id = 'example'): DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.

:

내가 로컬 DataTables-1.9.4를 사용하고 모든 것이 잘하지만 한 번 내 호스트 서버에 업로드 작동, 나는 이런 인기 JSON 구문 분석 오류가 발생 여기에 큰 충고 톤을 찾았습니다. 문제를 정확히 찾아내는 방법. 나는 문제가 간단하다는 크롬의 개발 도구의 네트워크 탭을 검토하고 결정한 : 사용자 이름 또는 암호 중 하나가 잘못된 :

Warning: mysql_pconnect() [function.mysql-pconnect]: Access denied for user 'username'@'localhost' (using password: NO) in /home/metros9/public_html/hunterpdx.com/metro_new_copy/server_processing.php on line 50

Warning: Cannot modify header information - headers already sent by (output started at /home/metros9/public_html/hunterpdx.com/metro_new_copy/server_processing.php:50) in /home/metros9/public_html/hunterpdx.com/metro_new_copy/server_processing.php on line 42 Could not open connection to server

그것은 대답은 간단해야 나에게 보인다. 나의 혼란 (그리고 질문)은 지역적으로는 훌륭하지만 살아있는 것은 아니라는 사실에서 비롯된다. db.php 파일을 사용하여 실제 사이트에서 여러 MySQL 쿼리에 대해 동일한 데이터베이스 연결 정보를 사용하고 있지만 server_processing.php에서 동일한 정보를 받아들이지 않는 이유가 있습니다. 아무도 그 이유를 말할 수 있습니까? 나는 새롭지 만, 알아내는 데는 매우 편리합니다 ... 찾고자하는 다른 일반적인 방향조차도 크게 감사 할 것입니다!

server_processing.php

/* 데이터베이스 연결 정보 */

$gaSQL['user']  = "*****"; 
$gaSQL['password'] = "*****"; 
$gaSQL['db']   = "*****"; 
$gaSQL['server']  = "localhost"; 



/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* If you just want to use the basic configuration for DataTables with PHP server-side, there is 
* no need to edit below this line 
*/ 

/* 
* Local functions 
*/ 
function fatal_error ($sErrorMessage = '') 
{ 
    header($_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error'); 
    die($sErrorMessage); 
} 


/* 
* MySQL connection 
*/ 
if (! $gaSql['link'] = mysql_pconnect($gaSql['server'], $gaSql['user'], $gaSql['password'] )) 
{ 
    fatal_error('Could not open connection to server'); 
} 

if (! mysql_select_db($gaSql['db'], $gaSql['link'])) 
{ 
    fatal_error('Could not select database '); 
} 
+0

해당 사용자가 database.check의 권한을 데이터베이스에 가지고 있지 않을 수 있습니다. – mohan

+0

좋은 시작이긴하지만 같은 생각을했습니다. 이미 사용자에게 모든 권한이 있음을 확인했습니다. 또한 다른 사용자 이름과 암호를 가진 두 번째 사용자를 만들었으며 전체 권한을 가졌습니다. 여전히 좋지 않다. –

+0

휴대 전화를 잡아라! 이제 작동합니다! ... 그리고 저는 바보입니다. 정말 간단합니다 : 변수 이름에 대문자를 사용하는 문제; gaSQL로 설정하고 gaSql이라고합니다 ... 저는 매우 어리 석습니다. –

답변

0

변수 gaSql로 gaSQL로 설정 한 후 호출되는 한 - 총액 불일치를!

쉽게 알 수 있지만 답을보기까지 얼마나 오랜 시간이 걸렸는지 알았습니다.