Хорошо, поэтому я пытаюсь отобразить информацию из моей базы данных с помощью jQuery DataTable (DataTables.net). Я могу заставить его работать отлично, отображая все "примечания" таблицы, но я хотел бы просто отображать заметки, которые не были прочитаны. Поэтому мне нужно каким-то образом включить предложение WHERE, но я не знаю, как это сделать.
Вот как я сейчас показываю всю таблицу:
// DB table to use
$table = 'Notes';
// Table primary key
$primaryKey = 'CID';
// Array of database columns which should be read and sent back to DataTables.
// The `db` parameter represents the column name in the database, while the `dt`
// parameter represents the DataTables column identifier. In this case simple
// indexes
$columns = array(
array( 'db' => 'CID', 'dt' => 0 ),
array(
'db' => 'CID',
'dt' => 0,
'formatter' => function( $d, $row ) {
return '<a href="profile.php?search='.$d.'" target="_Blank">'.$d."</a>";
}
),
array( 'db' => 'Title', 'dt' => 1 ),
array( 'db' => 'Name', 'dt' => 2 ),
array(
'db' => 'Date',
'dt' => 3,
'formatter' => function( $d, $row ) {
return date( 'jS M y', strtotime($d));
}
)
);
// SQL server connection information
$sql_details = array(
'user' => '*DB_USER*',
'pass' => '*Password*',
'db' => '*DatabaseName*',
'host' => 'localhost'
);
require( 'ssp.class.php' );
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
);
Мне понадобится эквивалент SELECT * FROM Notes WHERE Status ='Unread'