I am trying to make some sort of PHP game if you will, that will choose a set of numbers and change every week. How would this be done in PHP+MySQL? I just want to find out about this stuff before I start actually coding it.
Well, you'd just use rand($min, $max) to get your number (do this multiple times) and save them to a text file. The use a cronjob once a week to write new numbers to the text file.
mt_rand() produces better values IMO, if you need to generate lots and lots. But simple functions rand() is enough.
Yeah but I want it to automatically do this once a week. My idea is... Get the server's time, every 24x7 hours random number How would I accomplish that?
I already told you, via a cronjob that you set up to execute once per week. (Like every sunday at 0:00) Google it.
Just generate a timestamp via time(). It will always be unique as long as you don't run it 2 times in one second.
i think this is what your trying to do.. on your game lets say i just registered //Here you processed my register for etc now what you want to do is insert the time into the users table so we know it has been updated then everytime the user logs in to your game do summat like this if($row['last_update_time'] < ($row['last_update_time'])+(Calculate 7 days in mktime() here ))){ //then do your update thing here and then update the database with the new time() } PHP: