Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
是否可以在php中使用准备好的语句来创建事件?_Php_Sql_Events - Fatal编程技术网

是否可以在php中使用准备好的语句来创建事件?

是否可以在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

我试图用以下代码创建一个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 where seatNumber=$this->seatNumber AND idType=$this->seatType)";
它在执行时不会给出任何错误代码,但不会创建事件


我也尝试了bindParam方法,将参数传递给查询,但没有帮助

你能展示一下你是如何使用
$query
字符串的吗?你有没有尝试过将属性读入花括号中:例如
{$this->eventId}
?好的。这是MySQL吗?你在使用PDO吗?“我也尝试了bindParam方法,将参数传递给查询,但没有帮助”-出于某种原因,我感觉你试图将占位符传递给表/列。如果是这样的话,你就不能这么做。PDO或MySQLi_uu;prepared语句不支持表/列绑定。我认为MySQL不支持在prepared语句中创建事件。在“准备语句中允许的SQL语法”中,不包括事件。