php - Search in MySQL foreign field -
i'm new php , mysql.
i have 2 tables follows:
1.`users`: `id`//primary key : `name`//user's name 2.`events`: `u_id`//index key , foreign field users' id : `u_name`
a user input id
in form. id
searched in users
table , relevant details taken , inserted in events
table.
i've created foreign fields , and till made function took id
variable , returned details users
tables variables inserted in events
table. then, meant using "a lot" of variables , thought utilize of foreign field. i'm still learning php , don't know how find , insert using foreign fields 1 table another. know how create foreign fields. please help.
is you're talking about? how foreign key created.
create table parent (id int not null, primary key (id) ); create table kid (id int, parent_id int, index par_ind (parent_id), foreign key (parent_id) references parent(id) on delete cascade );
apologize if didn't understand question
updated
insert table1 (col1, col2, col3) select col1, col2, col3 table2 col1 = 'xyz'
hope helps
php mysql sql foreign-keys
No comments:
Post a Comment