MYSQL Event Scheduler DELIMITER using PHP
Posted
by
user1440918
on Stack Overflow
See other posts from Stack Overflow
or by user1440918
Published on 2012-06-06T22:36:12Z
Indexed on
2012/06/06
22:40 UTC
Read the original article
Hit count: 194
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!
© Stack Overflow or respective owner