-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbusiness_listing.php
72 lines (68 loc) · 1.7 KB
/
business_listing.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<html>
<head>
<title>
<?php
$doc_title = 'Business Listings';
echo "$doc_title\n";
?>
</title>
</head>
<body>
<h1>
<?= $doc_title ?>
</h1>
<?php
// establish the database connection
require_once('db_login.php');
$pick_message = 'Click on a category to find business listings:';
?>
<table>
<tr><td valign="top">
<table>
<tr><td class="picklist"><?= $pick_message ?></td></tr>
<p>
<?php
// build the scrolling pick list for the categories
$sql = "SELECT * FROM categories";
$result = $db->query($sql);
if (DB::isError($result)) die($result->getMessage( ));
while ($row = $result->fetchRow( )){
if (DB::isError($row)) die($row->getMessage( ));
echo '<tr><td class="formlabel">';
echo "<a href=\"$PHP_SELF?cat_id=$row[0]\">";
echo "$row[1]</a></td></tr>\n";
}
?>
</table>
</td>
<td valign="top">
<table>
<?php
if ($cat_id) {
$sql = "SELECT * FROM businesses b, biz_categories bc where";
$sql .= " category_id = '$cat_id'";
$sql .= " and b.business_id = bc.business_id";
$result = $db->query($sql);
if (DB::isError($result)) die($result->getMessage( ));
while ($row = $result->fetchRow( )){
if (DB::isError($row)) die($row->getMessage( ));
if ($color == 1) {
$bg_shade = 'dark';
$color = 0;
} else {
$bg_shade = 'light';
$color = 1;
}
echo "<tr>\n";
for($i = 0; $i < count($row); $i++) {
echo "<td class=\"$bg_shade\">$row[$i]</td>\n";
}
echo "</tr>\n";
}
}
?>
</table>
</td></tr>
</table>
</body>
</html>