last_insert_id always returns the same non-zero value
Posted on 2008-06-21
I am using last_insert_id to try to retrieve the id of the last record added to a table, just after the insert was done. The key field is auto_increment.
However, I ALWAYS get "Resource id #26", regardless of how many records there are in the table.
Even when the "next autoindex" figure (according to phpMyAdmin) is up around 31, I still get 26. I even tried completely clearing the table, but, there it was again - 26.
This is still a system in testing, and I am wondering if I have stuffed about with the table so much it needs rebuilding.
I am not sure what code or other details might be relevant.
All help appreciated!