Forum Moderators: coopster

Message Too Old, No Replies

Traffic exchange PHP help?

         

poundcke

3:11 am on Sep 30, 2005 (gmt 0)



I am having all kinds of problems with my traffic exchange script.
When I first login to my control panel I get the following error:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL
result resource in /home/groovyhi/public_html/control/index.php on line 142

If I go to my user list I see these 2 errors and I am not able to view
any user information or search through them:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL
result resource in /home/groovyhi/public_html/control/index.php on line 364

Warning: mysql_num_rows(): supplied argument is not a valid MySQL
result resource in /home/groovyhi/public_html/control/index.php on line 408

When I try to email my users I get this error:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL
result resource in /home/groovyhi/public_html/control/index.php on line 835

So I basically can't do anything but approve sites right now. I can't
even fulfill the orders I received last night and today. :(

The previous owner of the exchange used to help me with these things but I can't seem to get in touch with him. I am afraid if I try to fix this myself I will make things worse. If someone can fix this for me I will give you my login information and a payment.

Thanks,
Ana

[edited by: ergophobe at 5:39 pm (utc) on Sep. 30, 2005]
[edit reason] no personal urls please as per usage agreement [/edit]

ergophobe

5:44 pm on Sep 30, 2005 (gmt 0)

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



Did you change any code?

What's happening is that you are failing to return a result from a query, so no resource gets allocated... or you are using a variable that is not a resource for some other reason.

You need to verify that you're connecting to the database and sending a valid query. Since it has suddenly started happening in many places at once, I wonder whether you are getting denied access to the DB or at least to perform certain operations on the DB.

poundcke

10:44 pm on Sep 30, 2005 (gmt 0)



Hi,
Thanks for your reply. No, I didn't change any code. I don't know what to do.

ergophobe

3:37 pm on Oct 1, 2005 (gmt 0)

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



If you didn't make any changes to the code and you suddenly got this problem, I would say that something has happened with your DB configuration. Perhaps you're on a shared host and they upgraded mysql or something and the permissions have changed.

Try putting a test script on the server that does nothing but connect to the DB server and send a very simple query, using the same info that you are using to connect currently. So something like


$link = mysql_connect("hostname", "username", "password") or die("Could not connect to server: " . mysql_error());

mysql_select_db("db_name", $link) or die("Could not select DB: " . mysql_error());

$result = mysql_query("SELECT * FROM tableName") or die("Query failed: " . mysql_error());

var_dump($result);

Of course, you need to replace hostname, username, password, db_name and tableName with whatever matches on your system.

Once you've done that, run that script and see how far it makes it. If everything is working right, it should ID result as a resource when it gets dumped. If not, it should fail at the first problem.