Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

database connection problems


clarkster

Recommended Posts

I'm getting an error when application_top calls the tep_db_query function.

 

Password and things are all set right in configure.php

tep_db_connect seems to work just fine.

 

Here is the confusing part. I can take the query out of tep_db_query and it works just fine.

It only dies when I call that function.

 

For example. In application_top I did this:

 

tep_db_connect() or die('Unable to connect to database server!');

// set the application parameters
   //  $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
[b]$query='select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION;[/b]
$link = 'db_link';
$configuration_query = mysql_query($query, $$link) ;

NOTICE: I comment out the original call to that function and just query directly - it works just fine that way!

If I use this line it fails:

$configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);

 

I echo all the variables and they are just fine:

echo DB_SERVER;

echo DB_SERVER_USERNAME;

echo DB_SERVER_PASSWORD;

echo DB_DATABASE;

 

So, why is it failing when I call the function?

 

The error message is:

0

select configuration_key as cfgKey, configuration_value as cfgValue from configuration

[TEP STOP]

Link to comment
Share on other sites

check the IP address to mysql server, usernam, password and the permission for this user to access the right database.

Please read this line: Do you want to find all the answers to your questions? click here. As for contribution database it's located here!

8 people out of 10 don't bother to read installation manuals. I can recommend: if you can't read the installation manual, don't bother to install any contribution yourself.

Before installing contribution or editing/updating/deleting any files, do the full backup, it will save to you & everyone here on the forum time to fix your issues.

Any issues with oscommerce, I am here to help you.

Link to comment
Share on other sites

check the IP address to mysql server, usernam, password and the permission for this user to access the right database.

 

I've done all that. Everything is correct.

I can get it to work by moving the code from tep_db_connect into tep_db_query

 

I put this

$$link = mysql_connect($server, $username, $password);

if ($$link) mysql_select_db($database);

 

Into tep_db_query just above the actual query and it works.

So, that is telling my I'm losing the connection from the database between these two calls

 

tep_db_connect() and

tep_db_query()

 

Why would that be? A way to fix it?

 

Thanks.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...