Undefined variable and Undefined index
Undefined variable and Undefined index
hello Sir,
Firstly, thank you so much for providing such a good jquery plugin to show table. It helps me a lot when I needs to show some tabels.
What did I do:
I am using php(codeignitor)+jquery+datatables to make my applicatoin and I met a problem.
I made a page according to the sample:
http://datatables.net/examples/server_side/server_side.html
What did I meet:
I got a message box of DataTables warning: "JSON data from server failed to load or be parsed. This is most likely to be caused by a JSON formatting error."
and the table shows:Loading data from server.
I got 3 PHP Errors(Severity:Notice) in the page supplying the source json data for the table.
Undefined index: sSearch (if ( $_GET['sSearch'] != "" ))
Message: Undefined variable: sOrder($sQuery = "SELECT SQL_CALC_FOUND_ROWS id, engine, browser, platform, version, grade FROM test $sWhere $sOrder $sLimit)
Message: Undefined index: sEcho ($sOutput .= '"sEcho": '.intval($_GET['sEcho']).', ';).
What did I do to test:
I copy the same php code to a new php file (without codeigniter framework) and using this file to providing data to the previous table. the table works correctly.
If I modify the php.ini change the display errors to display_errors = Off, I got no notice on my page of supplying the source json data for the table, and the table shows Loading data from server all the time.
What did I do to solve the problem:
Add $_GET['sSearch'] =''; before using $_GET['sSearch']
Add $sOrder=''; before /* Ordering */
delete $sOutput .= '"sEcho": '.intval($_GET['sEcho']).', ';
then I got a table showing all the entries without sorting or search, and the select box of choosing 10,25,50,100 entries per page does not work.
any help to solove this prolbem is highly appreciated, thanks.
Firstly, thank you so much for providing such a good jquery plugin to show table. It helps me a lot when I needs to show some tabels.
What did I do:
I am using php(codeignitor)+jquery+datatables to make my applicatoin and I met a problem.
I made a page according to the sample:
http://datatables.net/examples/server_side/server_side.html
What did I meet:
I got a message box of DataTables warning: "JSON data from server failed to load or be parsed. This is most likely to be caused by a JSON formatting error."
and the table shows:Loading data from server.
I got 3 PHP Errors(Severity:Notice) in the page supplying the source json data for the table.
Undefined index: sSearch (if ( $_GET['sSearch'] != "" ))
Message: Undefined variable: sOrder($sQuery = "SELECT SQL_CALC_FOUND_ROWS id, engine, browser, platform, version, grade FROM test $sWhere $sOrder $sLimit)
Message: Undefined index: sEcho ($sOutput .= '"sEcho": '.intval($_GET['sEcho']).', ';).
What did I do to test:
I copy the same php code to a new php file (without codeigniter framework) and using this file to providing data to the previous table. the table works correctly.
If I modify the php.ini change the display errors to display_errors = Off, I got no notice on my page of supplying the source json data for the table, and the table shows Loading data from server all the time.
What did I do to solve the problem:
Add $_GET['sSearch'] =''; before using $_GET['sSearch']
Add $sOrder=''; before /* Ordering */
delete $sOutput .= '"sEcho": '.intval($_GET['sEcho']).', ';
then I got a table showing all the entries without sorting or search, and the select box of choosing 10,25,50,100 entries per page does not work.
any help to solove this prolbem is highly appreciated, thanks.
This discussion has been closed.
Replies
Hi!
I've had similar problem and decided it by this way:
1) downloaded new version of datatables-1.7 from this site;
if this wil not help -
2) try to look through your data in table of your database which you trying to use with datatables. Use any utulity for
manipulating with databases. Pay attention to records if there are any wrong symbols in the ends of data in some cells like symbols of paragraph etc. If any - try to remove them from data. Then it must work. Good luck.
I am using xampp server with
+ Apache 2.2.17
+ MySQL 5.5.8 (Community Server)
+ PHP 5.3.5 (VC6 X86 32bit) + PEAR
Received notice from browser:
Notice: Undefined index: sEcho in C:\xampp\htdocs\crm_pol\server_processing.php on line 148
any help?