php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3295 MYSQL_INSERT_ID not working
Submitted: 2000-01-24 10:35 UTC Modified: 2000-01-27 15:18 UTC
From: arni at linux dot is Assigned:
Status: Closed Package: MySQL related
PHP Version: 4.0 Beta 3 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: arni at linux dot is
New email:
PHP Version: OS:

 

 [2000-01-24 10:35 UTC] arni at linux dot is
Hello,

I wrote a PHP program that uses MYSQL_INSERT_ID() function. I begun writing the program under PHP3, but once the program was finished I upgraded my system to PHP4-b3.

Once the upgrade was complete I tried to use the program. But it wouldn't work because of a error MYSQL_INSERT_ID() caused.

The error is the following:
Warning: Supplied argument is not a valid MySQL-Link resource in phpfile.php3 on line 35

I don't know what causes this, my code works fine in PHP3, but this error only occures when I try to use it under PHP4-b3.

Could this be a BUG? :-)




Regards.

Arni Arent
Web Developer
Firmanet ehf.

arni@firmanet.is
http://www.firmanet.is

appel @ EFnet

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-01-24 14:06 UTC] joey at cvs dot php dot net
Show example of code.
 [2000-01-24 18:23 UTC] arni at linux dot is
Here are the 2 lines that matter:

$querymid = @mysql_query("insert into tempmail (userid,toaddress,cc,bcc,subject,priority,body,signature) values ('$uid','$to','$cc','$bcc','$subject','$priority','$body','$signature')");
$mailid = mysql_insert_id($querymid);

 [2000-01-27 15:18 UTC] torben at cvs dot php dot net
This isn't a bug; you've given mysql_insert_id() the result id from
the query instead of the link id from the connection--i.e., the value
returned by mysql_connect() or mysql_pconnect(). The code shown should 
work if you either supply that value or supply no argument; if none is 
given, the most recently opened link is assumed.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 20:01:32 2024 UTC