php - add records in two different tables -
i created table stores users details create table if not exists `users` ( `userid` int(11) not null auto_increment, `name` varchar(25) not null, `username` varchar(25) not null, `password` varchar(25) not null, primary key (`userid`), key `userid` (`userid`), key `userid_2` (`userid`) ) engine=innodb default charset=latin1 auto_increment=18 ; this 1 keep first name , last name 2 textboxes create table if not exists `data` ( `dataid` int(11) not null auto_increment, `firstname` varchar(25) not null, `lastname` varchar(25) not null, primary key (`surveyid`), key `firstname` (`firstname`), key `firstname_2` (`firstname`) ) engine=innodb default charset=latin1 auto_increment=2 ; and table has userid , dataid foreign keys. create table if not exists `jointable` ( `jointableid` int(11) not null auto_increment, `dataid` int(11) not null, `userid` int(11) not null, primary key (`jointableid`), key `surveyid` (`dataid`,`userid`), key `userid` (`userid`)