benhaynes Posted November 22, 2006 Share Posted November 22, 2006 Hey, I have a quick question... I have taught myself PHP and MySQL and am now pretty good, but having never taken courses... I am missing fundamental, easy stuff. For example, I am designing a CMS system with PHP/AJAX/MYSQL and keep getting an error about too many connections ... is this my fault? h ahaha h... I have my DB connection in a separate config.php file, and require_once it at the top of every page (including my AJAX pages that dont refresh the page).How often do I have to connect? And also,how often do I have to say "session_start();"? At the top of every page using SESSION variables? If it says it in my require_conce file do I still have to put it on the other pages?Sorry, I know this is a noob Q, but I have big holes in my knowledge..Thanks in advance... Quote Link to comment https://forums.phpfreaks.com/topic/28042-how-often-to-connect/ Share on other sites More sharing options...
joshi_v Posted November 22, 2006 Share Posted November 22, 2006 Well!It is ok to include dbconnection file in every file.It is enough too.no need to call that file again and again.But you should remember that, if there is any included files in your first file , where you are calling dbconnection file, and the called file also had a dbconnection file calling then you will get this errors. So you don't require to call dbconnection file in included files.For session_start also it is same.Regards,Joshi. Quote Link to comment https://forums.phpfreaks.com/topic/28042-how-often-to-connect/#findComment-128367 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.