-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtool_details.php
More file actions
executable file
·115 lines (103 loc) · 3.91 KB
/
tool_details.php
File metadata and controls
executable file
·115 lines (103 loc) · 3.91 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
session_start();
include 'lib/connection.php';
if (!isset($_SESSION['email'])) {
header('Location: index.php');
exit();
}
$toolID = mysqli_real_escape_string($conn, $_REQUEST['toolID']);
$query = "SELECT Tool.toolID, category, description, ".
"power_source, sub_type, sub_option, width_diameter, length, weight, manufacturer, ".
"purchase_price*0.4 AS deposit_price, ".
"purchase_price*0.15 AS rental_price, ".
"GROUP_CONCAT(acc_description) AS accessories ".
"FROM Tool LEFT OUTER JOIN ToolAccessory ON Tool.toolID = ToolAccessory.toolID ".
"LEFT OUTER JOIN Accessory ON ToolAccessory.accessoryID = Accessory.accessoryID ".
"WHERE Tool.toolID = '$toolID' ".
"GROUP BY Tool.toolID";
$result = mysqli_query($conn, $query);
$resultCheck = mysqli_num_rows($result);
if ($resultCheck >= 1) {
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
$tool_type = $row['category']." Tool";
$short_description=$row['description'];
$deposit_price=number_format($row['deposit_price'],2);
$rental_price=number_format($row['rental_price'],2);
$acc_description = $row['acc_description'];
$battery_type= $row['battery_type'];
$accessories = $row['accessories'];
$full_description=$row['width_diameter']. " inch by ".$row['length']. " inch, ".$row['weight']." lbs, ".
$row['description']. " by ".$row['manufacturer'];
}
?>
<!DOCTYPE html>
<html>
<head>
<title>View Profile</title>
<link rel="stylesheet" type="text/css" href="generic_customer.css">
</head>
<body>
<div class="header">
<ul class="headerList">
<li><a style="color: blue;">Hello <?php echo $_SESSION['first_name'] ?> !</a></li>
<li><a href="pickup_reservation.php">Pick-Up reservation</a></li>
<li><a href="dropoff_reservation.php">drop-off reservation</a></li>
<li><a href="add_new_tool.php">Add New Tool</a></li>
<li><a href="generate_report.php">Generate report</a></li>
<li><a href="logout.php">Logout</a></li>
</ul>
</div>
<div class="mainbody">
<div class="mainbodySpaceHolder"></div>
<div class="mainbodyWrapper2">
<div class = "title_name">Tool Details</div>
<fieldset>
<table>
<tr>
<td style="font-weight: bold;">Tool ID:</td>
</tr>
<tr><td>
<?php echo $toolID; ?>
<br><br></td></tr>
<tr><td style="font-weight: bold;">Tool Type:</td></tr>
<tr><td>
<?php echo $tool_type; ?>
<br><br></td></tr>
<tr>
<td style="font-weight: bold;">Short Description:</td>
</tr>
<tr><td>
<?php echo $short_description; ?>
<br><br></td></tr>
<tr>
<td style="font-weight: bold;">Full Description:</td>
</tr>
<tr><td>
<?php echo $full_description; ?>
<br><br></td></tr>
<tr>
<td style="font-weight: bold;">Deposit Price:</td>
</tr>
<tr><td>
<?php echo "\$ ". $deposit_price; ?>
<br><br></td></tr>
<tr>
<td style="font-weight: bold;">Rental Price per Day:</td>
</tr>
<tr><td>
<?php echo "\$ ". $rental_price; ?>
<br><br></td></tr>
<tr>
<td style="font-weight: bold;">Accessories:</td>
</tr>
<tr><td>
<?php echo str_replace(',', '<br/>', $accessories); ?>
<br><br></td></tr>
</table>
</fieldset>
</div>
<div class="mainbodySpaceHolder">
</div>
</div>
</body>
</html>