diff --git a/cake/libs/model/model_php4.php b/cake/libs/model/model_php4.php index 56c154c6c..67e4da5cf 100644 --- a/cake/libs/model/model_php4.php +++ b/cake/libs/model/model_php4.php @@ -862,7 +862,7 @@ class Model extends Object{ } } else { if ($db->create($this, $fields, $values)) { - $this->__insertID = $db->lastInsertId($this->table, $this->primaryKey); + $this->__insertID = $db->lastInsertId($this->tablePrefix . $this->table, $this->primaryKey); if (!$this->__insertID && $newID != null) { $this->__insertID = $newID; diff --git a/cake/libs/model/model_php5.php b/cake/libs/model/model_php5.php index b60e9f36f..ca4236e47 100644 --- a/cake/libs/model/model_php5.php +++ b/cake/libs/model/model_php5.php @@ -859,7 +859,7 @@ class Model extends Object{ } } else { if ($db->create($this, $fields, $values)) { - $this->__insertID = $db->lastInsertId($this->table, $this->primaryKey); + $this->__insertID = $db->lastInsertId($this->tablePrefix . $this->table, $this->primaryKey); if (!$this->__insertID && $newID != null) { $this->__insertID = $newID;