Re: not a valid MySQL result resource
| From: | Jan-Eric Duden | Date: | Fri, 27 Oct 2000 04:25:25 +0000 |
| Subject: | Re: not a valid MySQL result resource | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-22262@lists.php.net to get a copy of this message | ||
Check if $result is !=0 before you pass it to mysql_fetch_XXX
If $result is 0 check mysql_error()/ mysql_errorno() and look why the
mysql_query didn't work.
Hope it helps
Jan-Eric Duden
----- Original Message -----
From: "David Robley" <huntsman@hermes.nisu.flinders.edu.au>
To: "Gary" <deadfred@2die4.com>; <php-general@lists.php.net>
Sent: Thursday, October 26, 2000 8:27 PM
Subject: Re: [PHP] not a valid MySQL result resource
> On Fri, 27 Oct 2000, Gary wrote:
> > Hi All,
> >
> > I am getting tow error for a piece of code. can someone look this over
> > and see where I screwed up.
> >
> > Warning: Supplied argument is not a valid MySQL result resource in
> > g:\program files\apache
> > group\apache\htdocs\next.php on line 23
> > /td>
> > Warning: Supplied argument is not a valid MySQL result resource in
> > g:\program files\apache
> > group\apache\htdocs\next.php on line 33
> > PREV NEXT
> >
> > while ($data=mysql_fetch_array($result)){ <------------------line 23
> >
> > echo "<table border=1>\n";
> >
> > echo
> >
"<tr><td>ID</td><td>Accepted</td><td>Username</td><td>Password</td><td>Email
</td></tr>\n";
> >
> > } do {
> >
> >
printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s<td>/td><td>%s</tr>\n",$m
yrow["id"],$myrow["accepted"],$myrow["username"],$myrow["password"],$myrow["
email"]);
> >
> > } while($myrow = mysql_fetch_array($result)); <---------------line 33
> >
> > echo "</table>\n";
> >
> > thanks
> > Gary
> >
>
> http://www.php.net/FAQ.php#7.12
>
> --
> David Robley | WEBMASTER & Mail List Admin
> RESEARCH CENTRE FOR INJURY STUDIES |
> http://www.nisu.flinders.edu.au/
> AusEinet |
> http://auseinet.flinders.edu.au/
> Flinders University, ADELAIDE, SOUTH AUSTRALIA
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>