Closed km3945 closed 3 years ago
Please join
public function last_error(){ $error=$this->pdo->errorInfo(); return (bool)$error[2]; } ```php $opts=['a1'=>'aaa','uid'=>3]; $last_id=0; $this->db->action(function() use(&$opts, &$last_id) { $last_id = $this->db->insert("t_test", [ 'f_items' => $opts['a1'], 'f_uid' => $opts['uid'], ]); $this->saveItems($opts['a1'], $last_id); $this->addLog($last_id, $opts['uid'], $opts['user'], $opts['ip'], $opts['message']); if($this->db->last_error()){ $last_id=0; return false; } });
That will be improved on next v2.0.
https://github.com/catfan/Medoo/discussions/946
Please join