-
Notifications
You must be signed in to change notification settings - Fork 2
/
sample.php
66 lines (58 loc) · 2.12 KB
/
sample.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
<?php
require('php/connect.php');
// $sql2 = "SELECT add_email FROM add_email";
// $result2 = mysqli_query($conn, $sql2);
// if(!$result2){
// die("Query failed". mysqli_error($conn));
// }
// $emailArray = array();
// while($row2 = mysqli_fetch_assoc($result2))
// {
// foreach ($row2 as $key => $value) {
// $emailArray[] = $value;
// }
// }
// // print_r($emailArray);
// // echo "<hr>";
// $emails = implode(", ",$emailArray);
// echo $emails;
// $sql = "SELECT expiry_date, alert_month, weighbill_no, brand_name FROM inventory";
// $result = mysqli_query($conn, $sql);
// $monthArray = array();
// $messageArray = array();
// while($row = mysqli_fetch_assoc($result))
// {
// $weighBillNo = $row["weighbill_no"];
// $brandName = $row["brand_name"];
// $date = $row["expiry_date"];
// $alertMonth = $row["alert_month"];
// $new_format = date("M d, Y", strtotime($date));
// $now_date = date('Y-m-d');
// $diff = abs(strtotime($date) - strtotime($now_date));
// $months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
// foreach ($row as $key => $value) {
// if($key == "alert_month"){
// echo $value . " => ". $months . "<br>";
// if($value == $months){
// $messageArray[] = $row["brand_name"];
// }
// }
// }
// }
// $msg = implode(", ",$messageArray);
// echo $msg;
$sql2 = "SELECT add_email FROM add_email";
$result2 = mysqli_query($conn, $sql2);
if(!$result2){
die("Query failed". mysqli_error($conn));
}
$emailArray = array();
while($row2 = mysqli_fetch_assoc($result2))
{
foreach ($row2 as $key => $value) {
$emailArray[] = $value;
}
}
$emails = implode(", ",$emailArray);
var_dump($emails);
?>