$query1="insert into memuser (MemUser,MemPassword) values('$User','$Password');";
mysql_db_query($db,$query1) or die(mysql_error());
$result=mysql_insert_id($dbcon);
$query2="insert into member (IDNO,Name,SurName,IDcard,StudentID,Sex,Birthday) values('$result','$Name','$Surname','$IDcard','$StudentID','$Sex','$Birth');";
$query3="insert into memaddress (IDNO,MemAddress,Provincecd,ZipCode) values('$result','$Address','$Province','$Zipcode');";
$query4="insert into memphone (IDNO,PhoneType,PhoneNumber) values('$result','1','$Mobilephone');";
$query5="insert into memphone (IDNO,PhoneType,PhoneNumber) values('$result','2','$Telephone');";
$query6="insert into memcontact (IDNO,contacttype,contactString) values('$result','1','$Email');";
$query7="insert into memcontact (IDNO,contacttype,contactString) values('$result','2','$Facebook');";
$query8="insert into memcontact (IDNO,contacttype,contactString) values('$result','3','$Twister');";
$query9="insert into memcontact (IDNO,contacttype,contactString) values('$result','4','$Line');";
$query10="insert into memcontact (IDNO,contacttype,contactString) values('$result','5','$Skype');";
สลับตำแหน่ง เราต้อง query แล้วดึง id ให้เสร็จก่อน ถึงนำตัวแปรมาใช้งานในคำสั่งคิวรี่อื่นๆ ได้
$query1="insert into memuser (MemUser,MemPassword) values('$User','$Password');";
mysql_db_query($db,$query1) or die(mysql_error());
$result=mysql_insert_id($dbcon);
$query2="insert into member (IDNO,Name,SurName,IDcard,StudentID,Sex,Birthday) values('$result','$Name','$Surname','$IDcard','$StudentID','$Sex','$Birth');";
$query3="insert into memaddress (IDNO,MemAddress,Provincecd,ZipCode) values('$result','$Address','$Province','$Zipcode');";
$query4="insert into memphone (IDNO,PhoneType,PhoneNumber) values('$result','1','$Mobilephone');";
$query5="insert into memphone (IDNO,PhoneType,PhoneNumber) values('$result','2','$Telephone');";
$query6="insert into memcontact (IDNO,contacttype,contactString) values('$result','1','$Email');";
$query7="insert into memcontact (IDNO,contacttype,contactString) values('$result','2','$Facebook');";
$query8="insert into memcontact (IDNO,contacttype,contactString) values('$result','3','$Twister');";
$query9="insert into memcontact (IDNO,contacttype,contactString) values('$result','4','$Line');";
$query10="insert into memcontact (IDNO,contacttype,contactString) values('$result','5','$Skype');";
สลับตำแหน่ง เราต้อง query แล้วดึง id ให้เสร็จก่อน ถึงนำตัวแปรมาใช้งานในคำสั่งคิวรี่อื่นๆ ได้