Forum Moderators: coopster

Message Too Old, No Replies

works locally but not on upload

php and apache

         

ukgimp

1:48 pm on Sep 20, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a script that works fine on my local version of apache. When I upload it to another server, having altered the variables it gives the following error. Other scripts work fine using the same settings.

Warning: Supplied argument is not a valid MySQL result resource in blahblah/prototype/mysql.php3 on line 59.

Line 58-60 :
if( (!$results) or (empty($results)) ) {
mysql_free_result($results);
return false;

Is there an issue with versions of apache or something else.

Cheers and thanks in advance

jatar_k

6:07 pm on Sep 20, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



If I remember correctly that error implies that you are making a call to sql that has something wrong with it.

Is the value for $results working properly? Are you worried about taking too much memory?

The comparison itself seems flawed. If there are no results, free the memory $results is using. That is backwards. I would be more likely to think that if there are results then free them.

It looks like you are generating a mysql error because you are trying to free an empty variable. I would look at the logic of that area of code.

martin

7:22 pm on Sep 20, 2002 (gmt 0)

10+ Year Member



if( (!$results) or (empty($results)) ) {

the first check is redundant:

if(empty($results)) {

does the same.

Why do you want to free a result set if it does not exist anyway?
Shouldn't it be:

if(!empty($results)) {

ergophobe

1:57 am on Sep 21, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



A typical reason for this error is that you have a query that has a column in it that is not found in the database or something like that.

Use the "or die" command to have it output the query string. Then you can see what's happening and why the query is invalid. If it isn't immediately obvious, keep tweaking it and running it in the SQL client (shell, PhpMyAdmin, Mysql-Front or whatever you're using).

Tom

ukgimp

3:51 pm on Sep 21, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Cheers

I will look into those suggestions monday.

ukgimp

12:00 pm on Sep 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Commented out the two lines and re-tried. It did not fall down but there was no data. Also turns out there was an error in the schema I had used so that was masking the problem.

So two whole days spent on something that took two whole seconds to repair. :) FANTASTIC

Thanks