Re: RE: [PHP] mysql_insert_id

From: Date: Thu, 29 Jun 2000 02:11:59 +0000
Subject: Re: RE: [PHP] mysql_insert_id
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-3718@lists.php.net to get a copy of this message
> If I leave parameters blank so > > $lastID = mysql_insert_id(); > > $lastID is 0 (zero) > > > And also if I use: > $link = mysql_connect("$DBHost","$DBUser","$DBPass"); > $lastID = mysql_insert_id($link); > > $lastID is 0. Weird. I've got only two ideas: 1) Make sure you're inserting to a table with an AUTO_INCREMENT field. If MySQL didn't have to increment a value, it probably won't set the insert_id. 2) Make sure you aren't getting an error (e.g. echo mysql_error())

« previous php.general (#3718) next »