Page 1 of 1

mysql_insert_id(): problem

Posted: Fri Apr 07, 2006 7:38 am
by itsmani1

Code: Select all

include "conn.php";
	$ChkRes = mysql_query("select * from users where login = '" .$_POST['userid']. "'") or die(mysql_error());
	$ChkNum = mysql_num_rows($ChkRes);
	if($ChkNum > 0)
	{
		$str = "agegroup=".$_POST['year']."-".$_POST['month']."-".$_POST['day']."&userid=".$_POST['userid']."&readingp=".$_POST['readingp']."&fname=".$_POST['fname']."&lname=".$_POST['lname']."&sex=".$_POST['sex']."&email=".$_POST['email']."&city=".$_POST['city']."&state=".$_POST['state']."&zip=".$_POST['zip']."&country=".$_POST['country']."&toc=".$_POST['toc']."&terms=".$_POST['terms']."&user=does";
		header("Location:register.php?$str");
		exit;
	}
	else
	{
		$resultx = mysql_query("insert into users (login,password) values ('".$_POST['userid']."','".$_POST['password']."')") or die(mysql_error());
		$reidx = mysql_insert_id($resultx);
		echo $reidx;exit;
On execuation it gives me fowllowing error:
Warning: mysql_insert_id(): supplied argument is not a valid MySQL-Link resource in c:\wamp\www\atlantared\register_post.php on line 14

mysql_insert_id(): problem

Posted: Fri Apr 07, 2006 7:51 am
by cyberpunk71
The problem is not in this code. There may a problem in your conn.php. Submit your conn.php

Re: mysql_insert_id(): problem

Posted: Fri Apr 07, 2006 7:59 am
by feyd
cyberpunk71 wrote:The problem is not in this code. There may a problem in your conn.php. Submit your conn.php
It's actually the call to mysql_insert_id().