Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
July 25, 2005, 7:11 pm
rate this thread
About PHP::: Error/Problem PHP Warning: mysql_fetch_array():
In the past i use my code/script work fine with
Mandrake 9.1 - 10.1 ( + apache ,mysql )
Now i move to redhat EL4 with the same code/script
I got error can't login to my code.
and found error on /var/log/httpd/error_log like this
PHP Warning: mysql_num_rows(): supplied argument is not a valid MySQL
result resource in /var/www/html/website_in_server/showdata.php
PHP Warning: mysql_fetch_array(): supplied argument is not a valid
MySQL result resource in /var/www/html/website_in_server/showdata.php
I think problem source from php.ini or httpd.conf .
Anyone can help me sir.. ?
thank you for advance
Re: About PHP::: Error/Problem PHP Warning: mysql_fetch_array():
This means you did not check whether a previous mysql_* call (probably
mysql_query) was successful, and you continued anyway despite receiving "false"
as the return value.
No, it's missing error handling in your showdata.php file.
Check for whether the mysql_query call returned false - if it did, use
mysql_error() to display the error.
A simple way of doing this is:
$result = mysql_query($sql)
This is not very user friendly, but it does stop the script going any further
past an error, and tells you what the error is.
Once you've got that sorted you would be better off changing it to present a
more user friendly message rather than the raw underlying error.
If you don't understand the error that the mysql_error() function produces
here, then post that error back again, with a _short_ extract of the code
around the error, and someone here may be able to help you with the actual
<http://www.andyhsoftware.co.uk/space Space: disk usage analysis tool