zodiac Posted October 10, 2007 Share Posted October 10, 2007 Hey, i hope someone cam help me here. I am try to insert data from a register page into 3 tables in an access database, but i am unsure on how to do this. I have managed to insert into 1 but dont know what to change to get it to send the other data frpm the form into the other 2 tables at the same time. Hope you can help me. Zodiac Link to comment https://forums.phpfreaks.com/topic/72639-insert-into-3-tables-using-php/ Share on other sites More sharing options...
freakstyle Posted October 10, 2007 Share Posted October 10, 2007 you need to post code examples for any real help. access? why no mySql? Link to comment https://forums.phpfreaks.com/topic/72639-insert-into-3-tables-using-php/#findComment-366239 Share on other sites More sharing options...
MmmVomit Posted October 10, 2007 Share Posted October 10, 2007 My first instinct says use three queries, but others with more experience may know a better way. Link to comment https://forums.phpfreaks.com/topic/72639-insert-into-3-tables-using-php/#findComment-366241 Share on other sites More sharing options...
trq Posted October 10, 2007 Share Posted October 10, 2007 You will indeed need to use three queries. Link to comment https://forums.phpfreaks.com/topic/72639-insert-into-3-tables-using-php/#findComment-366246 Share on other sites More sharing options...
zodiac Posted October 10, 2007 Author Share Posted October 10, 2007 This is what i am working with at the moment, but im not sure if this is the correct way of doing it. I have just tried to do 3 seperate inserts. As you can see i have been commenting the code out to try and see if different things work. try //{ $adoCon->Execute //query to put data from textboxes to the database table //( "INSERT INTO User //(Etitle, Esurname, Eforename, Jobtitle, Areacoverage, EmployeeEmail) //VALUES //('$lsTitle', '$Forename', '$Surname', '$JobTitle', '$AreaCoverage', '$txtEmail');" //); //} //catch(Exception $e) //catch error //{ echo 'Sorry - There was a problem with adding the data to the database.<br />'; //} { $adoCon->Execute //query to put data from textboxes to the database table ( "INSERT INTO [user type] (Usertype) VALUES ('$UserType');" ); } catch(Exception $e) //catch error { echo 'Sorry - There was a problem with adding the data to the database.<br />'; } { $adoCon->Execute //query to put data from textboxes to the database table ( "INSERT INTO Login (Eforename, Esurname, Eusername, Epassword) VALUES ('$Forename', '$Surname', '$Username', '$txtPassword');" ); } catch(Exception $e) //catch error { echo 'Sorry - There was a problem with adding the data to the database.<br />'; } code] Link to comment https://forums.phpfreaks.com/topic/72639-insert-into-3-tables-using-php/#findComment-366254 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.