-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·57 lines (47 loc) · 1.28 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
session_start();
include 'header.php';
echo "<br><br><br><br><br><br> ";
if(!isset($_SESSION['name'])){
?>
<div style="text-align: right">
<a href="dashboard/login.php">
<button style="background-color: lightblue"> Login </button>
</a>
<a href="dashboard/signup.php">
<button style="background-color: lightblue"> Signup </button>
</a>
</div>
<?php
}
else{
?>
<div style="text-align: right">
Hii <?= $_SESSION['name'] ?>
<a href="dashboard/logout.php" style="color: blue"> Logout </a>
</div>
<?php
}
require 'db.php';
$imgurl = "img/";
$sql = "SELECT * FROM product";
$result = $conn->query($sql);
$nrow = $result->num_rows ;
?>
<div class="row">
<?php
if($result->num_rows > 0){
while ($row = $result->fetch_assoc()) {
?>
<div class="box">
<a href="product.php?pid=<?= $row['id'] ?>">
<img src="<?= $imgurl . $row['image'] ?>" />
<h3><?php echo $row['name'] ?></h3>
<p><?= $row['price'] ?></p>
</a>
</div>
<?php
}
} $conn->close();
?>
</div>