Following is my code:
$schedule = $this->db->query("CREATE EVENT ".$data['id']." ON SCHEDULE
EVERY 1 MONTH ON COMPLETION PRESERVE ENABLE DO INSERT INTO oops_invoice
(id, prefix, number, bill, account_id, order_delivery_id, date, staff_id,
customer_note, recurrence, status, itp, utp) VALUES ('', '".$data['prefix']."',
'".$data['number']."', '".$data['bill']."', '".$data['account_id']."', NULL,
'".$data['date']."', NULL, '".$data['customer_note']."', '".$data['recurrence']."',
'Draft', '".$data['itp']."', CURRENT_TIMESTAMP)");
$this->db->query("SET GLOBAL event_scheduler = 'ON'");
I stuck with id that how to retrieve id od row inserted by MySQL event..
i have tried following but does not worked when table is empty...
following code works fine except one case when table is empty....at that time it return nothing so i have been stuck...
this one is not same as we insert simple data this one inserted using MySQL event so $this->db->insert_id();
does not working......
$last = $this->db->query('SELECT MAX(id) AS `maxid` FROM `oops_invoice`')->row()->maxid;