-
Notifications
You must be signed in to change notification settings - Fork 1
/
QUERY8.php
57 lines (38 loc) · 811 Bytes
/
QUERY8.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
<html>
<head>
<style>
</style>
<title>Table with customer per month</title><style>
</style>
</head>
<body >
<?php
$host="localhost";
$dbUsername="root";
$dbPassword="";
$dbname="dept_store_original";
//create connection
$conn= new mysqli($host,$dbUsername,$dbPassword,$dbname);
if(mysqli_connect_error())
{
die('Connect Error('.mysqli_connect_errno().')'.mysqli_connect_error());
}
else{
$sql="SELECT SUM(V.CNT) FROM (SELECT COUNT(VISIT_ID) AS CNT
FROM SALE
WHERE BILL_DATE>=DATE(NOW())-30
GROUP BY VISIT_ID)V
;";
$result = mysqli_query($conn,$sql);
$resultCheck = mysqli_num_rows($result);
if($resultCheck > 0){
while($row1=mysqli_fetch_array($result)){
echo $row1[0];
}
}
}
?>
</body>
</html>
</body>
</html>