是否可以在php中使用准备好的语句来创建事件?
我试图用以下代码创建一个sql事件是否可以在php中使用准备好的语句来创建事件?,php,sql,events,Php,Sql,Events,我试图用以下代码创建一个sql事件 $query= "CREATE EVENT $this->eventId ON SCHEDULE AT CURRENT_TIMESTAMP + interval 1 minute ON COMPLETION NOT PRESERVE ENABLE DO UPDATE seats set seatStatus='free' where seatStatus='pending' and idSeat=(select idSeat from seats whe
$query= "CREATE EVENT $this->eventId ON SCHEDULE AT CURRENT_TIMESTAMP + interval 1 minute ON COMPLETION NOT PRESERVE ENABLE DO UPDATE seats set seatStatus='free' where seatStatus='pending' and idSeat=(select idSeat from seats where seatNumber=$this->seatNumber AND idType=$this->seatType)";
它在执行时不会给出任何错误代码,但不会创建事件
我也尝试了bindParam方法,将参数传递给查询,但没有帮助你能展示一下你是如何使用
$query
字符串的吗?你有没有尝试过将属性读入花括号中:例如{$this->eventId}
?好的。这是MySQL吗?你在使用PDO吗?“我也尝试了bindParam方法,将参数传递给查询,但没有帮助”-出于某种原因,我感觉你试图将占位符传递给表/列。如果是这样的话,你就不能这么做。PDO或MySQLi_uu;prepared语句不支持表/列绑定。我认为MySQL不支持在prepared语句中创建事件。在“准备语句中允许的SQL语法”中,不包括事件。