Php CodeIgniter事务不工作,也不生成任何错误

Php CodeIgniter事务不工作,也不生成任何错误,php,mysql,codeigniter,transactions,Php,Mysql,Codeigniter,Transactions,我正在尝试用事务复制具有新ID的记录,因为表字段应该随着时间的推移而更改,并且我不希望每次字段更新时都更改代码,这就是为什么事务似乎是我的最佳选择 事务的CodeIgniter代码: $this->db->trans_begin(); $this->db->query("CREATE TEMPORARY TABLE `prdct` SELECT * FROM `productsNew` WHERE `ID` = ? ", array($id)); $this-

我正在尝试用事务复制具有新ID的记录,因为表字段应该随着时间的推移而更改,并且我不希望每次字段更新时都更改代码,这就是为什么事务似乎是我的最佳选择

事务的CodeIgniter代码:

$this->db->trans_begin();

$this->db->query("CREATE TEMPORARY TABLE `prdct`
    SELECT * FROM `productsNew` WHERE `ID` = ? ", array($id));

$this->db->query("UPDATE `prdct` SET `ID` = ?, `type` = 'Return' WHERE `ID` = ? ", 
     array("Ret-".$id, $id));

$this->db->query("INSERT INTO productsNew SELECT * FROM prdct WHERE `ID` = ? 
ON DUPLICATE KEY UPDATE productsNew.intQuantity = productsNew.intQuantity + VALUES(intQuantity)",
array("Ret-".$id));

$this->db->query("DROP table prdct");

if ($this->db->trans_status() === FALSE) {
    $this->db->trans_rollback();
} else {
    $this->db->trans_commit();
}
我没有得到任何错误,所以不知道为什么它没有运行。用户似乎也拥有MySQL所需的所有特权