-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.php
51 lines (41 loc) · 1.48 KB
/
update.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
<?php
include "top.php";
// Begin output
print '<article>';
print '<h2>Database: ' . DATABASE_NAME . '</h2>';
//show the current persons list of bikes
print '<section id="existingBikes" class="float_left">';
if($currentUser == "bandreol" or $currentUser == "jrdyke"){
$query = "SELECT fldMake, fldModel, pmkSerialNumber ";
$query .= "FROM tblBike ";
//$query .= "JOIN tblCustomer ON tblBike.fnkCustomerId = tblCustomer.pmkCustomerId ";
$bikes = $thisDatabaseReader->select($query, "", 0, 0 ,0 ,0 ,false, false);
}else{
//// Pull info for 1 customer
$query = "SELECT fldMake, fldModel, pmkSerialNumber ";
$query .= "FROM tblBike ";
$query .= "JOIN tblCustomer ON tblBike.fnkCustomerId = tblCustomer.pmkCustomerId ";
$query .= "WHERE tblCustomer.pmkCustomerId = '" . $currentUser . "'";
$bikes = $thisDatabaseReader->select($query, "", 1, 0 ,2 ,0 ,false, false);
}
// Store bike info in associative array
//$bikes = $thisDatabaseReader->testQuery($query, "", 1, 0 ,2 ,0 ,false, false);
$numBikes = 0;
foreach($bikes as $bike){
$numBikes = $numBikes + 1;
}
if($numBikes > 1){
print "<h1>Here are your bikes</h1>";
}else{
print "<h1>Here is your bike</h1>";
}
print '<ol>';
foreach($bikes as $bike){
print '<li><a href="add.php?id=' . $bike["pmkSerialNumber"] . '&update=true">[UPDATE]</a> ';
print $bike["fldMake"] . ' ' . $bike["fldModel"] . '</li>';
}
print '</ol>';
print '</section>';
print '</article>';
include 'footer.php';
?>