我正在运行以下代码段:
$name= $this->session->userdata("user")->email;
$post_array["status"] = 0;
//print_r($post_array);
$event = "name".$primary_key;
$comment = "comment";
$this->db->query("DROP EVENT IF EXISTS ".$event."");
$sql =
"
CREATE DEFINER=`".$name."`@`%` EVENT `".$event."` \n
ON SCHEDULE \n
AT `".$post_array["timing"]."`\n
ON COMPLETION NOT PRESERVE\n
ENABLE\n
COMMENT '".$comment."'\n
DO BEGIN\n
update blog\n
set status = 1\n
where\n
blog_id = '".$primary_key."';\n
END;";
$this->db->query($sql);
它给我的错误:
Error Number: 1054 Unknown column '2017-03-08 13:23:30' in 'field list' CREATE DEFINER=`kisandrasgabor@gmail.com`@`%` EVENT `name_16` ON SCHEDULE AT `2017-03-08 13:23:30` ON COMPLETION NOT PRESERVE ENABLE COMMENT 'comment' DO BEGIN update blog set status = 1 where blog_id = '16'; END;
我在杂货店的更新事件之后处于收费状态,也许这会做一些时髦的事情,我不知道。
该函数将创建一个回调,whitch将禁用该帖子(状态字段设置为0,因此它不可见),然后在事件触发时重新启用它。然后事件将被删除。