I think what you're looking for is a cron job that triggers a PHP script to run. The MySQL database can contain information like "I have no new orders to process", or "Orders should be processed on Thursdays". Then the PHP script can read the data from MySQL and determine whether or not the conditions are right to continue processing or terminate. As a rule, MySQL can't itself trigger the PHP script to execute. cron is the tool you are looking for.