-
Notifications
You must be signed in to change notification settings - Fork 0
/
load_bu.php
35 lines (33 loc) · 1015 Bytes
/
load_bu.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 business units for a given category...</title>
</head>
<?php
$category = $_REQUEST['category'];
if (!$category) {
echo 'No category specified';
return;
}
$stmt = 'SELECT * FROM business_unit WHERE category="' . $category . '"';
$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;
}
}
?>