Jump to content

Mysql_connect -- 4th Parameter Question -- $new link


shanejeffery86

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.

  Quote
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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.