diff --git a/orif/stock/Models/Item_model.php b/orif/stock/Models/Item_model.php index 53b1fdc9..7891e453 100644 --- a/orif/stock/Models/Item_model.php +++ b/orif/stock/Models/Item_model.php @@ -60,7 +60,7 @@ public function initialize(){ * Returns the id that will receive the next item */ public function getFutureId(){ - $query = $this->db->query("SELECT AUTO_INCREMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'stock' AND TABLE_NAME = 'item'")->getResultArray(); + $query = $this->db->query("SELECT AUTO_INCREMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA = '{$this->db->database}' AND TABLE_NAME = 'item'")->getResultArray(); // Makes sure we select the auto_increment value $value = $query[0]['AUTO_INCREMENT'];