-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
42 lines (41 loc) · 1.01 KB
/
index.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
<?php include "header.php"; ?>
<html>
<head>
</head>
<body>
<br>
<div><center>
<table border=1><tr>
<?php
$counter = 0;
$con = mysqli_connect("localhost", "root", "", "project");
if(!$con){
die("Unable to connect");
}
$sql = "select * from product";
$res = mysqli_query($con, $sql);
while($row = mysqli_fetch_assoc($res)){
$id = $row['ProductId'];
$title = $row['Title'];
$price = $row['Price'];
$image = $row['Image'];
echo "<td>";
echo "<div><center><h3>$title</h3>";
echo "<a href=\"details.php?id=$id\">";
echo "<img height=280 width=160 src=\"$image\"></a>";
echo "<h4>Price: $price$</h4>";
echo "</div>";
echo "</td>";
$counter += 1;
if($counter === 4){
echo "</tr><tr>";
$counter = 0;
}
}
?>
</tr>
</table>
</center>
</div>
</body>
</html>