简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM