now were talking apples and oranges. you don't need PHP to do any of this. mySQL comes with mysqldump for backing up. if you want to execute mysqldump at a certain time interval (and you are using linux/unix) then use cron. an example crontab might look like this:
0 20 * * * /usr/local/bin/mysqldump --user=xxx --password=xxx database >/path/to/backup.sql 2>/path/to/errors.err
if you use windows then there is probably a way to do the same thing with the Windows Task Scheduler