PHP Mysql查询插入

I have a table - 'A' which has primary key - id which is auto incremented.I also have a table - 'B' which also has the column 'id'. Now I want to add entries to the table A so that value of id attribute of table 'A' which just got inserted to the table also gets inserted to B while other attributes of B can remain NULL.I know I can just make one table with all the columns but is there a way to do this with two tables??

Use the mysqli_insert_id () function right after you run the insert to table a. That will give you the value of the auto incremented id from table a which you can then populate in the surrogate key column of table b.

Read about it here: http://php.net/manual/en/mysqli.insert-id.php