This is my code ? PDO return always the last inserted id
as 0, I tried everything.!
$this->db()->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "INSERT INTO inbox (sender,recever) VALUES ('1','2')";
$this->db()->exec($sql);
$project_id =$this->db()->lastInsertId();
The sql
code table :
CREATE TABLE inbox(
id int(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
sender int,
recever int
);