Easiest way would be to create your PHP/MySQL script in the normal way, and run it from a web browser to test it.
Then, use the server's automation (e.g. cron on Linux) to set how often you want the script to run.
Have a look around for CRONning PHP jobs on Linux.