PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I'm trying to retrieve the mysqli insert_id from an INSERT database query but each time the result is 0. PLease can someone point me in the right direction as to what i'm doing wrong. Here is my query
The Manual wrote: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.
Do you have an auto-imcrementing column in your table?
P.S No " " are needed when using the PHP Code button.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering