DataTables warning: table id=example - Invalid JSON response.
$table = 'products1';
$primaryKey = 'product_id';
$columns = array(
array( 'db' => 'pname', 'dt' => 'pname' ),
array( 'db' => 'cat', 'dt' => 'cat' ),
array( 'db' => 'color', 'dt' => 'color' ),
array( 'db' => 'size', 'dt' => 'size' ),
array(
'db' => 'date_arrival',
'dt' => 'date_arrival',
'formatter' => function( $d, $row ) {
return date( 'jS M y', strtotime($d));
}
),
array(
'db' => 'price',
'dt' => 'price',
'formatter' => function( $d, $row ) {
return '$'.number_format($d);
}
)
);
// SQL server connection information
$sql_details = array(
'user' => 'root',
'pass' => '',
'db' => 'smart',
'host' => 'localhost'
);
require( 'ssp.class.php' );
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
);