0

I'm running the following snippet:

$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);

The error what it gives me:

    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;

I am in the calllback after update event of grocery crud, maybe that does something funky, I don't know.

The function would be the creation of a callback, whitch will disable the post (the status field is set to 0, so its invisible), then re-enables it when the event fires. Then the event is gonna be removed afterwords.

Frontrider
  • 47
  • 1
  • 10

0 Answers0