is it possible to insert Values into two tables using inner join..? tables are user,details
user table contains user_id,name,passwrd
details table contain id,address,email
what i Did:
if(isset($_POST['submit'])=='SUBMIT')
{
$user_name = $_POST['user_name'];
$user_password = $_POST['user_password'];
$details_email = $_POST['details_email'];
$details_phn = $_POST['details_phn'];
$details_age = $_POST['details_age'];
$SQL_QUERY="INSERT INTO tbl_user(user_name,user_password)VALUES('$user_name','$user_password')";
$result=mysql_query($SQL_QUERY);
$SQL_QUERY1="INSERT INTO tbl_details(details_email,details_phn,details_age)VALUES('$details_email','$details_phn','$details_age')";
$result1=mysql_query($SQL_QUERY1);
}
how can i rewrite with innerjoin...pls someone help me..
http://dev.mysql.com/doc/refman/5.0/en/join.html
MySQL supports the following JOIN syntaxes for the table_references part of SELECT statements and multiple-table DELETE and UPDATE statements:
You can't use join
for INSERT
. Sorry.
May I ask , what's the problem with 2 queries?
UPDATE Check @VolkerK 's comment, It offers alternative possible solutions: sql - insert into multiple tables in one query
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.