-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloth_table.php
More file actions
61 lines (51 loc) · 1.33 KB
/
cloth_table.php
File metadata and controls
61 lines (51 loc) · 1.33 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
<?php
/**
* Created by PhpStorm.
* User: Mahan
* Date: 7/30/2018
* Time: 8:13 AM
*/
include_once 'database.php';
if(isset($_POST['submit'])) {
header("Location: http://www.example.com/page.php");
exit;
}
?>
<html>
<style>
</style>
<body bgcolor="#add8e6">
<form action="add_clothes.php" method="post" >
<input style="float:right; margin-right:1500px;" type='submit' name='Add new product' value='Add new product' />
</form>
<table border="2">
<tr>
<th>Code</th>
<th>Title</th>
<th>Description</th>
<th>Type</th>
<th>Size</th>
</tr>
<?php
$sql= "SELECT * FROM cloth";
$result = $conn->query($sql);
if ($result -> num_rows > 0) {
for($i=0; $row = $result -> fetch_assoc();$i++){
?>
<tr style="background-color: <?php echo $i % 2==0 ? 'yellow':'white' ?>">
<td><?php echo $row ["code"] ?> </td>
<td><?php echo $row ["title"] ?> </td>
<td><?php echo $row ["description"] ?> </td>
<td><?php echo $row ["type"] ?> </td>
<td><?php echo $row ["size"] ?> </td>
</tr>
<?php
}
}else {
echo "0 results";
}
$conn->close();
?>
</table>
</body>
</html>