Jump to content

Recommended Posts

Hey all.

 

I am going to get straight to the point here.

 

I have a test site and a live site that are both operating on the same server and use separate databases on the server.

 

What is happening is that when a user goes from the test site to the live site or vice versa, the SQL connection from the previous site is still being used and a new connection is not being forced to open.

 

So, for the time being, I am having to hardcode the SQL connection code into each page and we all know that that is terrible coding practice.

 

I was researching mysql_connect and I found that there is a 4th parameter called $new_link.  Apparently, if you set it to true, it would force a new connection even if the old connection is using the same parameters?

 

Do I have my facts right? 

 

I do not mind having to force a new connection every time a new query runs as long as it is hitting the right database, which it is not at the moment.

use separate databases

 

Are these two databases on the same database server, if so, then the problem is not in the connection (which would only do what you are stating if your were using mysql_pconnect()) but in the selection of the database the query is using. What is your code that is selecting the database?

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.