-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrange2.php
88 lines (77 loc) · 3.72 KB
/
range2.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1,shrink-to-fit=no">
<!-- Bootstrap CDN -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<!-- Font Awesome CDN -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css">
<link rel="stylesheet" href="https://cdn.datatables.net/responsive/1.0.7/css/responsive.dataTables.min.css">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" ></script>
</head>
</html>
<?php
// Range.php
if(isset($_POST["From"], $_POST["to"]))
{
$conn = mysqli_connect("localhost", "root", "", "cartsystem","3308");
$result = '';
$query = "SELECT * FROM cakesales WHERE time BETWEEN '".$_POST["From"]."' AND '".$_POST["to"]."'";
$sql = mysqli_query($conn, $query);
$result .='
<table id="example" class="display responsive nowrap">
<tr>
<th style="background-color: mediumspringgreen;">No#</th>
<th style="background-color: mediumspringgreen;">Time</th>
<th style="background-color: mediumspringgreen;">Chocolate Cake </th>
<th style="background-color: mediumspringgreen;">Strawberry Cake </th>
<th style="background-color: mediumspringgreen;">Oreo Cake </th>
<th style="background-color: mediumspringgreen;">Caramel Cake </th>
<th style="background-color: mediumspringgreen;">Tiramisu Cake </th>
<th style="background-color: mediumspringgreen;">Cheesecake </th>
<th style="background-color: mediumspringgreen;">Macarons </th>
<th style="background-color: mediumspringgreen;">Yam Cupcake </th>
<th style="background-color: mediumspringgreen;">Action </th>
</tr>';
if(mysqli_num_rows($sql) > 0) {
$i = 1;
while($row = mysqli_fetch_array($sql))
{
$result .='
<tr>
<td>'.$i++.'</td>
<td>'.$row["time"].' </td>
<td>'.$row["ChocolateCake"].'</td>
<td>'.$row["StrawberryCake"].'</td>
<td>'.$row["OreoCake"].'</td>
<td>'.$row["CaramelCake"].'</td>
<td>'.$row["TiramisuCake"].'</td>
<td>'.$row["Cheesecake"].'</td>
<td>'.$row["Macarons"].'</td>
<td>'.$row["YamCupcake"].'</td>
<td><a href="cakesales.php?id=<?php echo $id;?><#modal2?id=<?php echo $id; ?>"> <button class="btn btn-success btn-sm" style="position:absolute; margin-top: -15px; left:1335px;" data-toggle="modal" data-target="#modal2" name="edit_data"><i class="fas fa-edit"></i></button></a>
<a href="cakesales.php?id=<?php echo $id; ?>"><button class="btn btn-danger btn-sm" style="position:absolute; margin-top: -15px; left:1375px;" name="del_data"><i class="fas fa-trash"></i></button></a></td>
</tr>';
}
}
else
{
$result .='
<tr>
<td style="text-align: center;" colspan="11">No Matching Records Found</td>
</tr>';
}
$result .='</table>';
echo $result;
}
?>
<script src="https://code.jquery.com/jquery-3.4.0.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.9/js/jquery.dataTables.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#example').DataTable();
} );
</script>