Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

What's the problem for mysql_query in database.php on line 64?


allright

Recommended Posts

Posted

Hi all,

 

The following warning messages are encountered in my osCommerce shop, may I be kindly advised how to resolve this problem? Is it related to "session" or what? appreciate much!

 

******************************************************************

Warning: mysql_query(): 9 is not a valid MySQL-Link resource in c:\program files\easyphp1-8\www\vmart\includes\functions\database.php on line 64

select count(*) as total from sessions where sesskey = 'a73c7c153b6c5e511c4b2ae15ee8fda7'

 

[TEP STOP]

 

Warning: mysql_query(): 9 is not a valid MySQL-Link resource in c:\program files\easyphp1-8\www\vmart\includes\functions\database.php on line 64

select count(*) as total from sessions where sesskey = 'a73c7c153b6c5e511c4b2ae15ee8fda7'

 

[TEP STOP]

Warning: Unknown(): A session is active. You cannot change the session module's ini settings at this time. in Unknown on line 0

******************************************************************

 

Best regards,

allright

Posted
Warning: mysql_query(): 9 is not a valid MySQL-Link resource in c:\program files\easyphp1-8\www\vmart\includes\functions\database.php on line 64

select count(*) as total from sessions where sesskey = 'a73c7c153b6c5e511c4b2ae15ee8fda7'

 

i doubt this is a session problem.

 

this is happening because the database resource (the value returned from a call to mysql_connect()) is not valid a valid resource when you try to use it. there are numerous things that can cause this, but they should be handled by the code before this kind of failure is seen. one possibility is that you close the resource and then try using it again.

 

also, it appears to me that you've made a few changes to the database code. my line 64 in database.php is not a call to mysql_query().

 

your best bet is to take a look at your recent changes and see if one of those is causing the $$link variable to be set to something other than a database resource. or double check that the resource is not used after the connection is closed.

 

if you still can't find it, post your code for database.php so that someone can take a look and see if there are any obvious errors.

Posted

Hi, thanks a lot!

 

The following is the \includes\functions\database.php on line 64:

 

$result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error());

 

 

Is it the same as yours ? thank you.

Posted
Hi, thanks a lot!

 

The following is the \includes\functions\database.php on line 64:

 

$result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error());

 

Is it the same as yours ? thank you.

 

nope. as i said, mine is different. i have that same piece of code on line 44, however.

 

which script are you running when you get this error? is it index.php, product_info.php or something else?

 

does this happen only on the script you are currently having the problem with, or all scripts?

 

have you verified that your database information is correct?

 

what version of oscommerce are you running? are you using a third-party template?

 

have you made any recent changes, and then started seeing this error? have you always seen this error and never had it working correctly?

Posted

>>which script are you running when you get this error? is it index.php, product_info.php or something else?

 

does this happen only on the script you are currently having the problem with, or all scripts?

 

--- all scripts

 

 

>>have you verified that your database information is correct?

--- DB is correct

 

 

>>what version of oscommerce are you running? are you using a third-party template?

 

--- 2.2, without 3rd party template.

 

>>have you made any recent changes, and then started seeing this error? have you always seen this error and never had it working correctly?

 

---- This happened when moving the site from SQL4 to SQL5.

 

Thank you!

Posted
---- This happened when moving the site from SQL4 to SQL5.

 

in a way, this is good, because your problem seems to be coming from a recent change. the problem is, that i don't have any idea why moving from sql4 to sql5 would cause this. i use 5 all the time, and i have worked on a few sites that use 4. all with no problems. have you asked your host if anyone else is having this sort of problem? it's possible the problem is on their end. i believe you need different drivers for php to talk to mysql4 and mysql5.

 

assuming for the moment that it's not a host problem, and since it's happening with all scripts, this makes me think that there may be a problem in application_top.php where it's setting up the db stuff. have you made any recent changes to application_top? and since your database.php code seems to be different, there may be other things going on in there.

 

please post (inside

 tags, so it's easier to read...) both application_top.php and database.php (not the ones in /admin) and we'll see what we can find in there.

Archived

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

×
×
  • Create New...