I have written a script to update my database, and every time the update process is done I want to open a new link
<?php
$con = mysql_connect("localhost","user","pass","db");
if (!$con){
die ("connection error: ". mysql_error());
}
mysql_query("set @date1=(select date_add(max(date),interval 1 day) from mail.PB)");
mysql_query("set @date2=(select max(date) from Report.Traffic_City)");
$b=mysql_query("select count(*) day from date.datemonthyear_telkomsel where date between @date1 and @date2");
$day=array();
while($row=mysql_fetch_array($b)){
for ($i=0; $i < $row['day']; $i++) {
mysql_query..................
$link="<script>window.open('http://localhost/link/mail/report.php');</script>";
echo $link;
}
}
?>
With the script above, my data update is successful, but the link open after looping process is complete (open at the same time as many times as it loops).
report.php is script for send last update data. My plan is, every time the data update process finishes open report.php link (so the data sent is the latest data), if there are 3 recent data
(example 2018-03-31,2018-04-01,2018-04-02)
So the data sent is 3 emails with data for the date 2018-03-31,2018-04-01,2018-04-02.