White_Lily Posted September 10, 2012 Share Posted September 10, 2012 Hi, I want to do a registration form where once submitted will go to "register_handler.php" which will check and insert all the information entered in the form prior to this page. I was wondering how I go about doing 2 SQL queries in one script? Quote Link to comment https://forums.phpfreaks.com/topic/268240-doing-multiple-queries-in-one-script/ Share on other sites More sharing options...
requinix Posted September 10, 2012 Share Posted September 10, 2012 Uh... the same way you'd do one query, except you have another one in there too? Don't have to duplicate the connect and close stuff, but the actual query part you'd just copy. Quote Link to comment https://forums.phpfreaks.com/topic/268240-doing-multiple-queries-in-one-script/#findComment-1376857 Share on other sites More sharing options...
White_Lily Posted September 10, 2012 Author Share Posted September 10, 2012 Doesn't having 2 queries break the script and show a 500 error? or thats what happens whenever ive done 2 queries in one script... Quote Link to comment https://forums.phpfreaks.com/topic/268240-doing-multiple-queries-in-one-script/#findComment-1376859 Share on other sites More sharing options...
requinix Posted September 10, 2012 Share Posted September 10, 2012 It shouldn't... Getting a 500 probably means there was a fatal error in the script. I don't know where but there's an option to turn on and turn off that "if the script has a problem then show a 500 error" setting; doing that means you'll get to see error messages right in the browser. Otherwise take a look at Apache's error log for more information about what went wrong. Your code will probably look something like include/require files that let you connect to the database run the first query stuff run the second query maybe disconnect but it's not required Quote Link to comment https://forums.phpfreaks.com/topic/268240-doing-multiple-queries-in-one-script/#findComment-1376860 Share on other sites More sharing options...
Mahngiel Posted September 10, 2012 Share Posted September 10, 2012 Doesn't having 2 queries break the script and show a 500 error? or thats what happens whenever ive done 2 queries in one script... No... Take a look at the bottom of the Freak board, there are usually 12-20 queries each load. How would that be possible? If you have a specific question, show the goods. Quote Link to comment https://forums.phpfreaks.com/topic/268240-doing-multiple-queries-in-one-script/#findComment-1376861 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.