mwm
02-19-2007, 03:11 PM
I need to do an insert into 2 tables. I need the id in both. I have tried several things and can't get it to work. I thought someone might tell what I"m doing wrong.
$query = "INSERT INTO contacts (id,fname,lname, title,company,address,city, state, zip, bphone, fax, mobile, email, category,ophone,website,haddress,hcity,hstate,hzip,hphone,hcell,hfax,hother,bday,spouse) values('$id','$fname','$lname','$title','$company', '$address','$city','$state','$zip','$bphone','$fax','$mobile','$email','$category','$ophone','$websi te','$haddress','$hcity','$hstate','$hzip','$hphone','$hcell','$hfax','$hother','$bday','$spouse')";
$result = mysql_query($query) or die("Could not insert");
$query1 = "INSERT INTO note_tbl(noteid,id,note)values('$noteid','{$_POST[id]}','$note')";
$result1 = mysql_query($query1) or die("Could not insert");
$query = "INSERT INTO contacts (id,fname,lname, title,company,address,city, state, zip, bphone, fax, mobile, email, category,ophone,website,haddress,hcity,hstate,hzip,hphone,hcell,hfax,hother,bday,spouse) values('$id','$fname','$lname','$title','$company', '$address','$city','$state','$zip','$bphone','$fax','$mobile','$email','$category','$ophone','$websi te','$haddress','$hcity','$hstate','$hzip','$hphone','$hcell','$hfax','$hother','$bday','$spouse')";
$result = mysql_query($query) or die("Could not insert");
$query1 = "INSERT INTO note_tbl(noteid,id,note)values('$noteid','{$_POST[id]}','$note')";
$result1 = mysql_query($query1) or die("Could not insert");