mysql_num_rows()

Permabanned
Joined
18 Oct 2002
Posts
12,841
Location
Lost!
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/wmo/public_html/frontend.php on line 17


Anyone know what this means - the site worked find until i had to move hosting provider adn now i get this?
 
NightmareXX said:
It would seem that your host is running a different version of PHP/MySQL then your previous host.
It means it doesn't have a result resource to use.

php.net said:
Parameters

result

The result resource that is being evaluated. This result comes from a call to mysql_query().
Most likely reasons are a changed MySQL configuration - check hostnames, usernames, passwords and so on :)
 
Beansprout said:
It means it doesn't have a result resource to use.
Isn't that almost the same as a different version? I installed PHP5 ages ago and it didn't come with any of the MySQL functions although that was a PHP thing.

Thinking about it now, passwords and stuff does seem like a more logical approach to what the problem is being caused by.
 
It means some part of your query failed. Check mysql_query hasn't returned false and check the values of mysql_error() and mysql_errno()

Although it's a possibility, it most likely has nothing to do with the mysql / php versions involved.
 
Moredhel said:
It means some part of your query failed. Check mysql_query hasn't returned false and check the values of mysql_error() and mysql_errno()

Although it's a possibility, it most likely has nothing to do with the mysql / php versions involved.
Code:
$result = mysql_query($sql,$conn) or die('<!--'.mysql_error().' -->';);
That's what I do quite a lot (well, similar) - throw MySQL errors between comment tags so users don't see them but you still get the debug info.

vBulletin does it so it must surely Be The Way. But then again vB also e-mails the administrator every time it trips over.....
 
Beansprout said:
Code:
$result = mysql_query($sql,$conn) or die('<!--'.mysql_error().' -->';);
That's what I do quite a lot (well, similar) - throw MySQL errors between comment tags so users don't see them but you still get the debug info.

vBulletin does it so it must surely Be The Way. But then again vB also e-mails the administrator every time it trips over.....
Hmm, I wouldn't ever leave the error message where the end user could see it, I tend to log them and throw a "nice" error message for the end user. That way no possible security info could get out. Of course I'm usually using my Exception class, which does it all automagically for me. :)
 
Moredhel said:
Hmm, I wouldn't ever leave the error message where the end user could see it, I tend to log them and throw a "nice" error message for the end user. That way no possible security info could get out. Of course I'm usually using my Exception class, which does it all automagically for me. :)
Ditto.. no errors that contain privy info such as DB login details (once the system is into 'live' environment,) should ever be produced to anywhere but a controlled log/area. Sensitive error messages, such as mysql_error() can and does produce make it so much easier for malicious attackers to gain access to areas they shouldn't. :)
 
Back
Top Bottom