Pre-filter a server.php script using where price > 100
Pre-filter a server.php script using where price > 100
chessGuru
Posts: 1Questions: 1Answers: 0
$result=mysqli_query($conn, "Select * from tbl where price>100");
correctly retrieves the data where price is greater than 100.
Now how do I filter the columns so it only accepts the new $results.
$columns = array(
// array( 'db' => 'id', 'dt' => 0 ),
array( 'db' => 'image', 'dt' => 0, 'formatter' => function( $d, $row ) {
return "<img class='zoom' src='$d' style='height:90px;width:90px;align:middle;'/>";
} ) ,
array( 'db' => 'name', 'dt' => 1 ),
array( 'db' => 'info', 'dt' => 2 ),
array( 'db' => 'price', 'dt' => 3, 'formatter' => function( $d, $row ) {
return "$$d";
} ),
);
echo json_encode(
SSP::simple( $_POST, $sql_details, $table, $primaryKey, $columns )
);
I would prefer to still use the https://datatables.net/examples/data_sources/server_side script if possible.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You need to apply a
where
condition to the SQL that theSSP
class is building. There is acomplex
method (rather than thesimple
one) which allows you to pass in the where condition.Allan