datatables parse json error

datatables parse json error

tuxworldstuxworlds Posts: 6Questions: 0Answers: 0
edited June 2013 in General
i'm using jquery datatables now , in using that on localhost no problem to use and fetch data from server, but after uploading files on real server that does not working and i get this error:
[code]
DataTables warning (table id = 'showTopics'): DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.
[/code]

WEBsite:
http://yiifa.ir/shirazee/_modir/contents_managment.php

after trace mysql command on server phpmyadmin, created command in server-side is ok, in firebug that show line 288

MYSQL command :
[code]
SELECT SQL_CALC_FOUND_ROWS c.title, i.id, i.subject, i.date_time, u.name, u.family, i.t_status FROM contents i JOIN categories c ON c.id = i.category JOIN users u ON u.id = i.posted_by WHERE i.post_type = 1 ORDER BY i.order_display
[/code]
tested this command in phpmyadmin is OK.

ERROR is:
[code]
Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in /home/yiifa/public_html/shirazee/_modir/server_processing.php on line 288

{"sEcho":0,"iTotalRecords":"1","iTotalDisplayRecords":"0","aaData":[]}
[/code]
LINE 288:
[code]
/*
* Output
*/
$output = array(
"sEcho" => intval($_GET['sEcho']),
"iTotalRecords" => $iTotal,
"iTotalDisplayRecords" => $iFilteredTotal,
"aaData" => array() // <- line 288
);
[/code]

showTopics :
[code]
oTable_topics =$('#showTopics').dataTable({
"bLengthChange": false,
"bStateSave": false,
"iDisplayLength": 8,
"bScrollCollapse": true,
"bJQueryUI": true,
"bAutoWidth": false,
"sAjaxSource": "server_processing.php",
"sPaginationType": "full_numbers",
"bProcessing": true,
"oLanguage": {
"sEmptyTable" : '<?php _tr('no_topic_seved'); ?>'
},
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
// Bold the grade for all 'A' grade browsers
if ( aData[5] == '1' )
f_buttons = "";
else
f_buttons = "";
f_buttons += "";
f_buttons += "";
$('td:eq(4)', nRow).html( f_buttons );
},
"fnDrawCallback": function(oSettings) {
clickRowHandler_topics();
if ( oSettings.aiDisplay.length == 0 )
{
return;
}
var nTrs = $('tbody tr', oSettings.nTable);
var iColspan = nTrs[0].getElementsByTagName('td').length;
var sLastGroup = "";
for ( var i=0 ; i

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Right enough - the data returned is not valid JSON. The warning about `mysql_fetch_array()` makes it invalid. Fix and that it will be resolved.

    Allan
  • tuxworldstuxworlds Posts: 6Questions: 0Answers: 0
    edited June 2013
    hi allan.
    thats all of ok in localhost , thats error is for this which mysql_fetch_array() ???
    this error is for datatables
    [code]
    $output = array(
    "sEcho" => intval($_GET['sEcho']),
    "iTotalRecords" => $iTotal,
    "iTotalDisplayRecords" => $iFilteredTotal,
    "aaData" => array()
    );
    [/code]

    my server side file:

    http://yiifa.ir/server_processing.txt
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    The result you are passing into the function is null for some reason. I'd suggest echo out the generated SQL and debugging the PHP script.

    Allan
This discussion has been closed.