Table1 ID is auto increment and i also want to store the information from table 2 against that auto generated ID

Posted on

Question :

This table has an auto increment ID on back end.

"INSERT INTO `test`.`personal_info`
    (`username`, `email`,`password`)
VALUES ('$username','$email','$password')";

This was for signing up of one page. Following is the page code which I want to link to upper table.

"UPDATE `test`.`personal_info` 
WHERE Id='10' (`Name`, `Mid_name`, `Last_name`,`d_o_b`) 
VALUES ('$Name', '$Mid_name', '$Last_name','$date')";

Answer :

You want to update field ID and set to 10?

Some sample:

UPDATE test.personal_info
SET ID = '10'
WHERE db1.table1 = db2.table2

OR

 UPDATE test.personal_info
 SET ID = '10'
 ON <DB.TABLE>
 JOIN TABLE1.FIELD = DB.TABLE2.FIELD

Leave a Reply

Your email address will not be published. Required fields are marked *