Query (serverside) to Datatable

Query (serverside) to Datatable

JCR1951JCR1951 Posts: 34Questions: 6Answers: 0

I'm working serverside.
Now I have a query to select some ID's for a record.

      // run query
$value = "3-7-11-2-6-";
$result= explode("-", $value);
$where = implode(",", $result);

$sql = "SELECT * FROM markers WHERE id ='$where'";

if (!$result = $mysqli->query($sql)) 
{
    echo "<li>Sorry, the website is experiencing problems.";
}
else
{
$record = $result->fetch_assoc();
    echo "<br>".$record['cb'];
    echo "<br>".$record['id'];
    echo "<br>".$record['name'];

}

My other code goes like this:

      // DB table to use
$table = 'markers';
 
// Table's primary key
$primaryKey = 'id';
 
$columns = array(
    array( 'db' => 'cb', 'dt' => 'cb' ),
    array( 'db' => 'id', 'dt' => 'id' ),    
    array( 'db' => 'name', 'dt' => 'name' ),
        .
        .
        .
);
require( 'ssp.class.php' );
 
echo json_encode(
    SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
);

Can someone help me to make this work together?
Do I have to edit the ssp.class.php ?

Answers

  • allanallan Posts: 63,803Questions: 1Answers: 10,515 Site admin

    I don't really understand what you are trying to achieve I'm afraid. What is the goal here? Are you trying to apply a WHERE condition to the data fetched by the SSP class? If so, have a look at the complex method that it provides, which allows conditions to be passed in.

    Allan

This discussion has been closed.