-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver2.php
More file actions
47 lines (40 loc) · 1.6 KB
/
server2.php
File metadata and controls
47 lines (40 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
// DB table to use
$table = 'tbl';
// Table's primary key
$primaryKey = 'id';
// Array of database columns which should be read and sent back to DataTables.
// The `db` parameter represents the column name in the database, while the `dt`
// parameter represents the DataTables column identifier. In this case simple
// indexes
$columns = array(
array( 'db' => 'id', 'dt' => 0),
array( 'db' => 'name', 'dt' => 1, 'formatter' => function( $d, $row ) {
//return "<h5 class='cart_name'>$d</h5>";
return $d;
} ),
array( 'db' => 'price', 'dt' => 2, 'formatter' => function( $d, $row ) {
return "<span class='cart_price'>$$d</span>";
} ),
array( 'db' => 'qtd', 'dt' => 3 , 'formatter' => function( $d, $row ) {
return "<select class='cart_qtd'> <option selected='selected' value='$d'>$d</option></option><option>1</option><option>2</option><option>3</option><option>4</option></select>";
} ),
array( 'db' => 'total', 'dt' => 4, 'formatter' => function( $d, $row ) {
return "<span class='cart_total'>$$d</span>";
} ),
//array( 'db' => 'date', 'dt' => 3),
);
$sql_details = array(
'user' => '',
'pass' => '',
'db' => '',
'host' => 'localhost'
);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If you just want to use the basic configuration for DataTables with PHP
* server-side, there is no need to edit below this line.
*/
require( 'ssp.class.php' );
echo json_encode(
SSP::simple( $_POST, $sql_details, $table, $primaryKey, $columns )
);