0

I'm making a website using PHP that offers the user a button 'Generate list', once clicked the website reads data (names) from database (MySQL) and match each name with a number and print them, the numbers must change each day at midnight. How do I make my PHP script increment the number for example every midnight?

  • 5
    Use a cron job to run a script at midnight to update it. Or use the MySQL Event Scheduler. – Barmar Nov 23 '21 at 20:46
  • Where are these numbers coming from? If you just want to randomly assign a fresh number to each name every day, you could just use a random number generated seeded using the current date (for example: `srand(intval(date("ymd")));`). Then select the names in a consistent order (e.g., alphabetically ascending), and assign each one the next value of `rand()`. – r3mainer Nov 23 '21 at 20:55

0 Answers0