所有数据都可以显示但“sEcho”值为空

时间:2010-07-09 04:14:57

标签: php

 if (postVar('sSearch') !="" ) {
    $sWhere = " WHERE Line LIKE '%".mysql_real_escape_string( $_POST['sSearch'] )."%' OR ".
              "Model LIKE '%".mysql_real_escape_string( $_POST['sSearch'] )."%' OR ".
              "NIK LIKE '%".mysql_real_escape_string( $_POST['sSearch'] )."%' ";
    }
 $sQuery = "SELECT  Line, Model, NIK FROM   inspection_report ".$sWhere.$sOrder.$sLimit;
 $rResult = mysql_query( $sQuery) or _doError(_ERROR30 . ' (<small>' . htmlspecialchars($sql) . '</small>): ' . mysql_error() );

 $sQuery = "SELECT  Line, Model, NIK FROM   inspection_report ".$sWhere.$sOrder.$sLimit;
 $rResult = mysql_query( $sQuery) or _doError(_ERROR30 . ' (<small>' . htmlspecialchars($sql) . '</small>): ' . mysql_error() );

        $sQuery = "SELECT FOUND_ROWS()";
        $rResultFilterTotal = mysql_query( $sQuery) or _doError(_ERROR30 . ' (<small>' . htmlspecialchars($sql) . '</small>): ' . mysql_error() );  // submit SQL to My$
        $aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
        $iFilteredTotal = $aResultFilterTotal[0];

        $sQuery = "SELECT COUNT(Line) FROM   inspection_report";

        $rResultTotal = mysql_query( $sQuery) or _doError(_ERROR30 . ' (<small>' . htmlspecialchars($sql) . '</small>): ' . mysql_error() );  // submit SQL to MySQL an$
        $aResultTotal = mysql_fetch_array($rResultTotal);
        $iTotal = $aResultTotal[0];

        $sOutput = '{';
        $sOutput .= '"sEcho": '.$sEcho.','; 

我一直在使用该代码,但为什么结果为空? {"sEcho": ,

1 个答案:

答案 0 :(得分:0)

 $sOutput = '{';
        $sOutput .= '"sEcho": '.intval($_POST['sEcho']).',';     
        $sOutput .= '"iTotalRecords": '.$iTotal.', ';
        $sOutput .= '"iTotalDisplayRecords": '.$iTotal.', ';
        $sOutput .= '"aaData": [ ';