|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-04-20 09:58 UTC] momo@php.net
[2003-04-20 10:53 UTC] philip@php.net
[2003-04-21 16:21 UTC] alindeman@php.net
[2003-04-28 11:45 UTC] sniper@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 07:00:01 2025 UTC |
I copied a few lines of code from the net and got it to work in my own test environment. When I placed the software on the production server (linux PHP 4.1.2) - it only "almost" worked. The problem was that it had lines with statements like: mysql_insert_id(); where strange id's sometimes were returned ! Then, when I changed the code to: mysql_insert_id($con); // The ?resource link_identifier? everything was fine. I believe that what happened was that my program received id's from somebody else doing INSERT on the same server? My conclusion was: Never use the function without the "resource link_identifier" ! And then again, - Why should you? In the documentation it says:"If link_identifier isn't specified, the last opened link is assumed." My code was simply: $sql= "INSERT INTO xrefs (referrer) VALUES ('$ref')"; echo "sql $sql <br>"; $result = mysql_query($sql,$con); //$referrer_id = mysql_insert_id(); // FAILED $referrer_id = mysql_insert_id($con); // WORKED OK