last_insert_id return 0

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
spraypray12
Forum Newbie
Posts: 1
Joined: Thu Apr 26, 2007 2:21 pm

last_insert_id return 0

Post by spraypray12 »

Whatever i try, it still retuns 0. In php script, in mysql query browser, every insert id return 0.

MySQL version 4.1.2
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Post your code.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

Jcart wrote:Post your code.
and your table structure.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

http://dev.mysql.com/doc/refman/5.0/en/mysql-insert-id.html wrote:Note that mysql_insert_id() returns 0 if the previous statement does not use an AUTO_INCREMENT value.
Post Reply