Skip to content
Advertisement

How to show certain rows only in serverside processing?

I would like to show only certain rows to logged in users where “column_name” = “some_value” in serverside-processing. Currently i use following code below.

$table = 'tablename';
$primaryKey = 'id';
$columns = array(
   array( 'db' => 'id', 'dt' => 0 ),
   array( 'db' => 'name', 'dt' => 1 ), // need to only select where name ="example"
   array( 'db' => 'views', 'dt' => 2 )
);
}
$sql_details = array(
   'user' => 'db_user',
   'pass' => 'db_pass',
   'db' => 'db_name',
   'host' => 'localhost:3306'
);
require( 'server-processing.php' );
echo json_encode(
    SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
);

How do i achieve this?

Advertisement

Answer

We can do this by using

  SSP::complex( $_GET, $sql_details, $table, $primaryKey, $columns , "column_name = 'some_value'"  )

instead of simple use complex and then add "column_name = 'some_value' extra inside the bracket.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement