简体   繁体   English

为什么MySQL不返回最后插入的ID,它返回0?

[英]Why is MySQL not returning the last inserted id, it returns 0?

I have a table that has a primary key that autoincrements. 我有一个表,该表具有自动递增的主键。 Everytime I insert a row to that table, and use mysql_insert_id() to get the last id inserted for that table, it returns 0. 每次我向该表插入一行,并使用mysql_insert_id()获取为该表插入的最后一个ID时,它将返回0。

What other possible problems could there be? 还有什么其他可能的问题?

使用OpenCart提供的方法:

$this->db->getLastId()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM