How to make a connection to the database?

Good evening.

Can't deal with relationships in the database.

There таблица_1(id,name) and таблица_2(user_id, param_1,param_2)

I can not understand how to do the following: adding a person in таблицу_1, in this moment created the entry in таблице_2, and such that user_id = id(from табл_1) and created param_1,param_2 for this user_id.

Tell me how to implement this, or point - in which direction to look?)
September 18th 19 at 23:47
2 answers
September 18th 19 at 23:49
to hang the trigger on INSERT in таблица_1
Thank you! Triggers - this is what I needed, all sorted - Frederic_Keebler commented on September 18th 19 at 23:52
September 18th 19 at 23:51
$query = mysql_query("INSERT INTO orders_in_shop (id_client, price_order, status, data_order) VALUES ('$id_client','$price','$status', '$data')");
$id_order_in_shop = mysql_insert_id();

Here for example you have added in the variable id and the following queries are already added in the table.

Find more questions by tags MySQLDatabases