mysql_insert_id error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

mysql_insert_id error

Post by itsmani1 »

Please see this error :

Code: Select all

include "conn.php";
	$rr = mysql_query("insert into users (login,password) values('asdf','asdf')");
	$ri = mysql_insert_id($rr);
Outut:
Warning: mysql_insert_id(): supplied argument is not a valid MySQL-Link resource in c:\wamp\www\atlantared\register_post.php on line 4
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

Code: Select all

mysql_query("insert into users (login,password) values('asdf','asdf')", $link);
$ri = mysql_insert_id();
Try that - include your database $link in the mysql_query, and leave mysql_insert_id empty.
Post Reply