Jump to content

MySQL connection script


verdrm

Recommended Posts

OK, by safer I mean that include will not stop the page from loading if the file is not present, but require_once will not allow the page to be processed normally if, for example, the required connection file is not found.

 

Basically, my hosting provider (GoDaddy) claims that I have 50 simultaneous MySQL connections available per user. What does that mean? Does that mean only 50 people can access my website at once (because the data comes from MySQL)?

 

Are there ways to get around that? I need to figure out how to optimize my scripts so only one connection is being made per user. If I have six pages, each with require_once connection script, does that mean six connections are being made that are not closed when the user goes to another page?

Link to comment
Share on other sites

If I require_once a MySQL connection script on each page of my website, does that mean a new connection is being made each time? What is the best way to minimize the amount of connections being made to the database?

 

No. It means that whenever the code of that script is called (e.g. it contains functions) and it connects to MySQL, it connects to MySQL. :)

 

Roughly: Calls = Total calls to the script * mysql connections that the scripts uses

Link to comment
Share on other sites

I'm still slightly confused.

 

If the user logs in, and the home.php page has require_once, is that a connection? Then, if they click on another page that has require_once, is that another connection? How does that work?

 

Also, what would my hosting provider mean by 50 simultaneous MySQL connections per user?

Link to comment
Share on other sites

I'm still slightly confused.

 

If the user logs in, and the home.php page has require_once, is that a connection? Then, if they click on another page that has require_once, is that another connection? How does that work?

 

Also, what would my hosting provider mean by 50 simultaneous MySQL connections per user?

 

You don't need to worry. 50 SIMULTANEOUS MySQL connections is GOOD. You 'll need to have a lot of people visiting your site to need an upgrade in hosting. :)

 

A require_once tells you nothing about how many connections the script does to the MySQL server.

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.