2010-07-09 5 views
-1
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.','; 

J'ai déjà utilisé ce code mais pourquoi le résultat est vide? {"sEcho": ,toutes les données peuvent afficher mais "sEcho" valeur vide

+3

Où est le reste du code? Nulle part dans le code que vous avez posté, $ sEcho est défini sur n'importe quoi, donc il sera évidemment vide. – quantumSoup

+0

il me fais confondre bcoz à firebugs (XHR): à params show sEcho: 1 mais à la réponse sEcho:, – klox

+0

Je ne comprends pas pourquoi vous avez supprimé votre question initiale. Comme je l'ai dit ici, je pense que le problème est avec la méthode 'postVar'. Vous devriez montrer son code. –

Répondre

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