Pre-filter a server.php script using where price > 100

Pre-filter a server.php script using where price > 100

chessGuruchessGuru Posts: 1Questions: 1Answers: 0
edited February 2019 in Free community support

$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

Answers

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin
    Answer ✓

    You need to apply a where condition to the SQL that the SSP class is building. There is a complex method (rather than the simple one) which allows you to pass in the where condition.

    Allan

This discussion has been closed.