-
Notifications
You must be signed in to change notification settings - Fork 1
/
allitemslist.php
32 lines (31 loc) · 1.23 KB
/
allitemslist.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
<!DOCTYPE html>
<html>
<head></head>
<body>
<?php
$connection = mysqli_connect("localhost", "root", "", "shopping") or die("Check your sql connection!");
$query = "select item_code, item_name, description, imagename, price from products";
$results = mysqli_query($connection, $query) or die(mysql_error());
echo "<table align=\"center\" border = \"0\">";
$x = 1;
echo "<tr>";
while($row = mysqli_fetch_assoc($results)) {
if($x < 5) {
$x = $x + 1;
extract($row);
echo "<td style = \"padding-right:15px;\">";
echo "<a href = itemdetails.php?itemcode=$item_code>";
echo '<img src=' . $imagename . ' style="max-width:220px; max-height:240px; width: auto; height: auto;" /><br />';
echo $item_name . '<br />';
echo "</a>";
echo '$' .$price . '<br />';
echo "</td>";
} else {
$x = 1;
echo "</tr><tr>";
}
}
echo "</table>";
?>
</body>
</html>