RE: [PHP] upgrade, mysql_insert_id broken
| From: | Greg Donald | Date: | Fri, 07 Jul 2000 01:45:00 +0000 |
| Subject: | RE: [PHP] upgrade, mysql_insert_id broken | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-5301@lists.php.net to get a copy of this message | ||
> 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
------------------------------------------------------------------------
destiney - (des-ti-nêy) - n. 1. deity of all things "html", 2. common
internet addict, 3. lover of late 80's heavy metal music, 4. Activist
for the terminally un-elite; see also - cool guy, des, mr. php...
It's 4:00am, your web site is still up, why are you?
http://destiney.com/
------------------------------------------------------------------------