Tuesday, 20 August 2013

How Insert two table

How Insert two table

i already write code like this:
$password = md5($password);
mysql_query("INSERT INTO `users`
(username,password,email,pnum,hintque,hintans)
VALUES('$username','$password','$email','$cnum','$hintque','$hintans')");
mysql_query("INSERT INTO `personal`
(userid,fname,lname,address,dob,country,state,city,poscode)
VALUES(LAST_INSERT_ID(),'$fname','$lname','$address','$dob','$country','$state','$city'.'$zip')");
header("location: ../register.php?feedback=Registration
Complete. You May Now Login");
but only first sql success to insert data. for the second one fail. i want
both query triggered on the same time.

No comments:

Post a Comment