-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview.php
47 lines (42 loc) · 1.15 KB
/
view.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
<?php
//including the database connection file
include_once 'ivud.php';
$view = new ivud();
//fetching data in descending order (lastest entry first)
$query = "SELECT * FROM items ";
$result = $view->viewAll($query);
//echo '<pre>'; print_r($result); exit;
?>
<html>
<head>
<title>View Data</title>
</head>
<body>
<table width='100%' border=2>
<tr bgcolor='#CCCCCC'>
<td>ID</td>
<td>Category</td>
<td>Name</td>
<td>Ingredients</td>
<td>Preparation</td>
<td>Picture</td>
</tr>
<?php
$id=$_GET["id2"];
foreach ($result as $key => $res) {
if($res['id']==$id || is_null($id))
{
echo "<tr>";
echo "<td>".$res['id']."</td>";
echo "<td>".$res['category']."</td>";
echo "<td>".$res['name']."</td>";
echo "<td>".$res['ingredients']."</td>";
echo "<td>".$res['preparation']."</td>";
echo "<td>"."<img src='images\\".$res['picture']."'width=100px height=100px></td>";
echo "</tr>";
}
}
?>
</table>
</body>
</html>