0

I need to generate 3 ramdom numbers everyday at 16:00 gmt o'clock and save(add) them on 3 diferent tables with date.

DB name: Wp_Funlottery

Tables: Number01 , Number02, Number03

Fields: id (secuense / Number (XX) / Date (dd/mm/yyyy)

1
  • And what is preventing you from doing that? Please explain your specific problem.
    – fuxia
    Apr 28, 2020 at 21:19

1 Answer 1

0

date_default_timezone_set('GMT');

$today = date('H:i');

for($i=1; $i<=365; $i++) { $repeat = strtotime("+1 day",strtotime($today)); $today = date('g:i a',$repeat);

}

$date1 = date("1:09 a");

//IMPORTANT: This must be at the top of your page1.html before anything is sent to browser! if($today==$date1){

$random1 = rand(00,99);

$random2 = rand(00,99);

$random3 = rand(00,99);

$randate1 = date('Y-m-d');

$link = mysqli_connect("localhost", "funlotto", "5K39S3p2!g", "funlotto");

// Check connection if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); }

// Attempt insert query execution $sql1 = "INSERT INTO lotto_1 (number, date) VALUES (".$random1.", now())"; if(mysqli_query($link, $sql1)){ echo "Records inserted successfully."; } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } $sql2 = "INSERT INTO lotto_2 (number, date) VALUES (".$random2.", now())"; if(mysqli_query($link, $sql2)){ echo "Records inserted successfully."; } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } $sql3 = "INSERT INTO lotto_3 (number, date) VALUES (".$random3.", now())"; if(mysqli_query($link, $sql3)){ echo "Records inserted successfully."; } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); }

// Close connection mysqli_close($link);

exit;

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.