I have 2 tables, users and syssla where syssla_id is a foreign key in users(syssla_id2)
.
create table syssla(
syssla_id int auto_increment,
Uppgift varchar (255),
Information text,
Tid varchar(100),
primary key(syssla_id)
)engine=innodb;
create table users(
user_id int ,
username varchar (50),
user_password varchar (50),
Namn varchar(100),
syssla_id2 int,
primary key(user_id),
foreign key(syssla_id2) references syssla(syssla_id)
)engine=innodb;
I want to do an insert with a form in php
. But how can I do to get the foreign key to be inserted to a specific user in the other table(users)
at the same time?