我尝试使用 Zend DB 执行此查询:
$this->db->query("
CREATE EVENT turn_tonormal
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 MINUTE COMMENT 'Return the calendar state to NORMAL'
DO
SELECT type FROM calendar WHERE id = 64;
UPDATE calendar SET type = IF(type = 'OK', 'OK', 'NRML') WHERE id=64;
DROP event turn_tonormal;
");
在 phpMyAdmin QSL 中一切正常,我在 UPDATE 之前使用 if 条件创建此事件但是从 php 我收到此错误:
Mysqli prepare error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE mind_calendar SET timeband_type = IF(timeband_type = 'PRENOTED', 'PRENOTE' at line 5
我认为这是因为 Zend DB 查询只执行一个查询,而我有不止一个。我怎么能解决。
在此先感谢并为糟糕的英语道歉:)