-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction2.php
49 lines (44 loc) · 1.6 KB
/
action2.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
<?php
include 'config.php';
$output='';
if(isset($_POST['query'])){
$search=$_POST['query'];
$stmt=$conn->prepare("SELECT * FROM deliveredorders WHERE id LIKE
CONCAT('%',?,'%') OR name LIKE CONCAT('%',?,'%')");
$stmt->bind_param("ss",$search,$search);
}
else{
$stmt=$conn->prepare("SELECT * FROM deliveredorders");
}
$stmt->execute();
$result=$stmt->get_result();
if($result->num_rows>0){
$output = "<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Products</th>
<th>Total Amount (RM)</th>
<th>Order Period</th>
<th>Deliver Period </th>
</tr>
</thead>
<tbody>";
while($row=$result->fetch_assoc()){
$output .="
<tr>
<td>".$row['id']."</td>
<td>".$row['name']."</td>
<td>".$row['products']."</td>
<td>".$row['amount_paid']."</th>
<td>".$row['order_timestamp']."</th>
<td>".$row['deliver_timestamp']."</th>
</tr>";
}
$output .="</tbody>";
echo $output;
}
else {
echo"<h3>No Records Found!</h3>";
}
?>