-2

Im try to get datatable from query, which select from where clause, but not working :

<?php
  include "koneksi.php";
    $query=mysql_query("SELECT @rownum := @rownum + 1 AS urutan,t.      id_data, nama_aut, judul_abs, file_abs, status_lolos, status_bayar
  FROM datauser   WHERE status_lolos = "Sudah" t,
  (SELECT @rownum := 0) r");
   $data = array();
   while($r = mysql_fetch_assoc($query)) {
   $data[] = $r;
}

 $i=0;
   foreach ($data as $key) {
    // add new button
   .....
$i++;
 }
   $datax = array('data' => $data);
echo json_encode($datax);
?>

error

Parse error: syntax error, unexpected 'Sudah' (T_STRING)

But if not use where clause , thats working fine :

  <?php
  include "koneksi.php";
    $query=mysql_query("SELECT @rownum := @rownum + 1 AS urutan,t.       id_data, nama_aut, judul_abs, file_abs, status_lolos, status_bayar
  FROM datauser   t, 
  (SELECT @rownum := 0) r");
   $data = array();
   while($r = mysql_fetch_assoc($query)) {
   $data[] = $r;
}
 ...

Anyone can help, im newbie..

chris85
  • 23,846
  • 7
  • 34
  • 51
hahaha
  • 45
  • 2
  • 11

2 Answers2

0

no need to use double qoute for Sudah:

 FROM datauser   WHERE status_lolos = "Sudah" t,
Therichpost
  • 1,759
  • 2
  • 14
  • 19
0

$query=mysql_query("SELECT @rownum := @rownum + 1 AS urutan,t.id_data, nama_aut, judul_abs, file_abs, status_lolos, status_bayar FROM datauser t WHERE status_lolos = 'Sudah', (SELECT @rownum := 0) r");

user1544541
  • 193
  • 3