-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetData.php
48 lines (40 loc) · 1.27 KB
/
getData.php
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
48
<?php
// Database connection info
$dbDetails = array(
'host' => 'localhost',
'user' => 'Kyle12_12',
'pass' => 'MaddenBase12',
'db' => 'maddenbaseposts'
);
// DB table to use
$table = 'posts';
// 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.
// The `dt` parameter represents the DataTables column identifier.
$columns = array(
array( 'db' => 'image', 'dt' => 0,
),
array( 'db' => 'positionteam', 'dt' => 1 ),
array( 'db' => 'description', 'dt' => 2 ),
);
$searchFilter = array();
if(!empty($_GET['search_keywords'])){
$searchFilter['search'] = array(
'image' => $_GET['search_keywords'],
'positionteam' => $_GET['search_keywords'],
'description' => $_GET['search_keywords'],
);
}
if(!empty($_GET['filter_option'])){
$searchFilter['filter'] = array(
'positionteam' => $_GET['filter_option']
);
}
// Include SQL query processing class
require 'ssp.class.php';
// Output data as json format
echo json_encode(
SSP::simple( $_GET, $dbDetails, $table, $primaryKey, $columns, $searchFilter )
);