1. 程式人生 > >關於mysql_insert_id()返回0的問題

關於mysql_insert_id()返回0的問題

The mysqli_insert_id() function returns the ID generated by a query on a table with a column having the AUTO_INCREMENT attribute. If the last query wasn\'t an INSERT or UPDATE statement or if the modified table does not have a column with the AUTO_INCREMENT attribute, this function will return zero.
對資料表具有AUTO_INCREMENT屬性的欄位,mysqli_insert_id()函式返回由查詢所生產的ID號.如果最後一個查詢不是INSERT或UPDATE,或UPDATE的表不具有AUTO_INCREMENT屬性,函式將返回0.