First of all I am currently trying to learn php and I thought I would build a basic maintenance management app to better grasp everything I see in tutorials, and I hit a roadblock. I've been trying to get this to work following various tutorials online but I had no success so far, so I thought I would ask for help here. I really hope you can help me.
What I would like to know is how can I write the php & mysql to write the data from the first 3 table to the desired_table from below ?
Clients
------------------------------
client_id | client_name
------------------------------
1 | client_1
------------------------------
2 | client_2
------------------------------
3 | client_3
Equipments
------------------------------
eq_id | eq_name
------------------------------
1 | pc
------------------------------
2 | laptop
------------------------------
3 | printer
Operations
------------------------------------------------
op_id | op_desc
------------------------------------------------
1 | dust cleaning
------------------------------------------------
2 | changing processor cooling paste
------------------------------------------------
3 | cpu replacement
------------------------------------------------
4 | display replacement
------------------------------------------------
5 | dvd-rom replacement
------------------------------------------------
6 | ram replacement
------------------------------------------------
7 | cartrige replacement
Desired_table
-------------------------------------
id | client_id | eq_id | op_id |
-------------------------------------
1 | 1 | 1 | 1 |
-------------------------------------
2 | 1 | 1 | 2 |
-------------------------------------
3 | 1 | 1 | 3 |
-------------------------------------
4 | 1 | 1 | 5 |
-------------------------------------
5 | 1 | 2 | 1 |
-------------------------------------
6 | 1 | 2 | 2 |
-------------------------------------
7 | 1 | 2 | 4 |
-------------------------------------
8 | 2 | 1 | 1 |
-------------------------------------
9 | 2 | 1 | 2 |
-------------------------------------
10| 2 | 1 | 3 |
-------------------------------------
11| 2 | 1 | 5 |
-------------------------------------
12| 2 | 3 | 1 |
-------------------------------------
13| 2 | 3 | 7 |
I thought I would have a form with input fields for the client data and the equipment data and operations data I would have in dropdowns. When I would select an equipment a new dropdown would appear with the operations, and then submit it.
Hope this doesn't get marked as too broad subject :)