-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathload_bu_items.php
35 lines (33 loc) · 986 Bytes
/
load_bu_items.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
<html>
<head>
<title>Load all items for a given business unit...</title>
</head>
<?php
$buid = $_REQUEST['bu_id'];
if (!$buid) {
echo 'No business unit specified';
return;
}
$stmt = 'SELECT * FROM bu_item WHERE bu_id=' . $buid;
$mysql_client = mysqli_connect('koodemo.cwmhshxpuljc.us-west-2.rds.amazonaws.com',
'koomaster',
'koopassword',
'koodb');
if ($mysql_client->connect_errno) {
echo 'Failed to connect to Mysql: ' . $mysql_client->error
. ' (' . $mysql_client->connect_errno . ')';
return;
} else {
$result = $mysql_client->query($stmt);
if ($result) {
$rows = $result->fetch_all(MYSQLI_ASSOC);
echo json_encode($rows);
$result->free();
$mysql_client->close();
} else {
echo 'Failed to load all business units: ' . $mysql_client->error;
$mysql_client->close();
return;
}
}
?>