RE: [PHP] upgrade, mysql_insert_id broken

From: Date: Fri, 07 Jul 2000 01:37:10 +0000
Subject: RE: [PHP] upgrade, mysql_insert_id broken
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-5302@lists.php.net to get a copy of this message
On Thu, 06 Jul 2000, Greg Donald wrote: > > Well, I allways do my queries as such > > $sql = "INSERT INTO sometable (name, description) VALUES ('this', > > 'that')"; > > $result = mysql_query($sql ,$db); // $db is the connection I made > > with $db = > > mysql_connect > > > > $new_id = mysql_insert_id($db); > > > > Note that I use the database link identifier. Try just > > $new_id = mysql_insert_id(); > > in your case. It'll use the last used link identifer > > I see, so I need to point it to the last connection rather than the last > query... Ok, it works great now. Wonder how it was working all that time > incorrectly before when I was running PHP 3... > > Thanks alot! > > Greg No problem :) I had the same problem with scripts I wrote for work. We migrated to PHP4 and and it quit works...very annoying :) -- - James Atkinson 'Today is an illusion, it is but an echo of yesterday and a shadow on tommorow' http://www.totalgeek.org

« previous php.general (#5302) next »