Re: mysql_fetch_array warnings.
| From: | Nicole Amashta | Date: | Tue, 23 Apr 2002 14:28:57 +0000 |
| Subject: | Re: mysql_fetch_array warnings. | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-13241@lists.php.net to get a copy of this message | ||
Your code is possibly failing at this line:
> $result = mysql_query($query);
Make sure that the value in $result is != 0
so, try this:
<snip>
##assuming you've already connected to the database, etc...
$query = "select * from users where UserName LIKE '$username'";
if ( $result = mysql_query($query) )
{
if ($row = mysql_fetch_array($result)) {
## ...
## ...
}
}
else
{
echo "Your query failed. Reason: " . mysql_error_msg();
}
</snip>
--
Nicole Amashta
Web Application Developer
www.aeontrek.com
"Martin.Andrew" <Martin.Andrew@kpmg-ct.com> wrote in message
news:2670E10E092AD943BAAE845456A017245DD218@exchange-dh.kpmg-ct.com...
> testing locally I use the following code
>
> $query = "select * from users where UserName LIKE '$username'";
> $result = mysql_query($query);
> if ($row = mysql_fetch_array($result)) {
> ...
> ...
> }
>
> works fine.
>
> On the ISP machine I get the following warnings?
>
> Supplied argument is not a valid MySQL result resource !!
>
> Do I need to change a setting?
>
>
>
>
>
>
>
>