Jump to content

How often to connect...


benhaynes

Recommended Posts

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...
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.