Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Database Connection


djenniex

Recommended Posts

I've been unsuccessfully trying to connect to a second database inside oscommerce. I was hoping that someone in this forum would have the answer.

 

My config file looks like this:

  define('DB_SERVER', 'localhost'); 
 define('DB_SERVER_USERNAME', 'oscommerce');
 define('DB_SERVER_PASSWORD', 'osc');
 define('DB_DATABASE', 'catalog');
 define('USE_PCONNECT', 'false'); // use persistent connections?
 define('STORE_SESSIONS', 'mysql');
 define('DB_ONLINE_SERVER_USERNAME', 'online');
 define('DB_ONLINE_SERVER_PASSWORD', 'online');
 define('DB_ONLINE_DATABASE', 'online_login');

At the start of a function, I call:

tep_db_connect(DB_SERVER, DB_ONLINE_SERVER_USERNAME, DB_ONLINE_SERVER_PASSWORD, DB_ONLINE_DATABASE, $online_db_link);

Perform a couple of queries on the database, then at the end of the function, I close the connection and restart the original db connection using

tep_db_connect();

This ends up giving me an error:

0 -



[TEP STOP]

 

Can anyone point me in the right direction to solve this problem?

Link to comment
Share on other sites

I don't understand what you are trying to do here.

 

Is this a local install on your computers server?

 

If this is an install on an online server, and you are trying to get two domains to use one database - think again! You won't be able to access a db on one domain from another domain unless you have a static ip address for the domain that is trying to access the domain with the db, and your web hosting company has given you specific access on the server to do so.

 

Vger

Link to comment
Share on other sites

Sorry my question was not clear enough. Both databases are on the same server, and I am trying to access it locally.

 

Let me explain what the function that I mentioned before does. When a user purchases a product from the store, their user information is entered into another database (online_login) that allows them to access another part of the website.

 

The other part of the website, uses the online_login database for login verification.

 

Hope that clears up some confusion.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...