0

TABLE ONE

a_id, a_title, a_desc, user_id

TABLE TWO

a_id, to_user_id

The script i have written so far puts all data in one table with 5 columns like this

a_id, a_title, a_desc, user_id, to_user_id

Code :

INSERT INTO table(a_title,a_desc,user_id,to_uid_fk)
VALUES('$title','$desc','$uid','$UserTo')

the script and the data are send ok

to_user_id stores multiples ids (e.g. 123,432,1232 and so on) thats why i created another child table to store to_user_id in different rows.

How do i do that?

  1. how to i take the a_id which is auto increment and take it to the child (second) table

  2. how do i store multiple values of to_user_id?

this is how i want to store data in the child table

INSERT INTO table_name (a_id,to_user_id)
VALUES ('3','634'), ('3','6532'), ('3','194');
Strawberry
  • 33,750
  • 13
  • 40
  • 57

0 Answers0