LuisDesigns wrote:
> Hey guys, i get this error :
>
Warning: mysql_fetch_array(): supplied argument is not a valid
MySQL result
> resource in
/home/therainb/public_html/myphptests/view_files.php on line 17
> I try lots of diff things to fix it, one one them was
adding the '@' just
> before the mysql_fecth...
> while ($row =
@mysql_fetch_array ($result, MYSQL_ASSOC)) {
>
> which did get rid of the error but, it says :
There are currently no files
> to be viewed.
No, it didn't get rid of the error. It got rid of the error
message. @
is the error control operator, and PHP beginners should be
banned from
using it until they learn what error messages mean. Sorry to
sound
harsh, but error messages are there to help you. The error
control
operator should be added only after you have verified that
the script is
working correctly. Its purpose is to hide error messages that
might be
of assistance to malicious attackers.
Read the error message again. It says that the argument you
supplied to
mysql_fetch_array() isn't a valid MySQL result resource. In
other words,
there's something wrong with your SQL query. To find out what
it is, you
need to display the error message returned by MySQL
Change this:
> $result = mysql_query ($query);
To this:
$result = mysql_query($query) or die(mysql_error());
--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/