MYSQL Event Scheduler DELIMITER using PHP
- by user1440918
I'm having an issue with my PHP code trying to create events within MySQL. I begin with creating a string like this:
$sql="DELIMITER $$ CREATE EVENT `$test_name` ON SCHEDULE EVERY $time1 $sched2
STARTS '$start_date $start_time' DO BEGIN ";
$sql .="INSERT INTO blah (foo,bar); ";
$sql .="END$$ DELIMITER ;"
mysql_query($sql,$dbh);
But I keep getting Syntax Errors starting with DELIMITER $$ CREATE EVENT. Without the semicolon behind (foo,bar); the event triggers with a unexecuted payload.
Any ideas on where I'm going wrong?
Thanks!