Re: Join causing Error?
| From: | CC Zona | Date: | Sun, 25 Feb 2001 09:12:41 +0000 |
| Subject: | Re: Join causing Error? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-41566@lists.php.net to get a copy of this message | ||
In article <030601c09f05$2b9e6e70$53daead8@gilanet.com>,
larentium@gilanet.com ("Keith Spiller") wrote:
> Can anyone tell me why this:
> Line 282 mysql select db("centraldb",$db);
> Line 283 $qorder++;
> Line 284 $result = mysql query("SELECT q.questid, q.question, q.answer,
> q.qorder, q.depart, q.catid,
> q.active, q.global, q.adate, q.author, q.authoremail,
> q.askemail, c.catid, c.category, c.under,
> c.corder, c.active FROM central groupfaqq q, central
> groupfaqcat c WHERE q.active = '1' AND
> q.global = '1' AND c.active = '1' ORDER BY c.under,
> c.order, q.qorder",$db);
> Line 285 while ($myrow = mysql fetch row($result))
>
> Would cause this error:
> Warning: Supplied argument is not a valid MySQL result resource in
> faqbody.php3 on line 285
>
> When changing the same SELECT statement to:
> Line 284 $result = mysql query("SELECT * FROM central groupfaqq WHERE
> active = '1' ORDER BY
> qorder",$db);
>
> Works perfectly?
Sounds like the 'while' loop is failing because mysql_query isn't returning
to $result what you think it is. Add some error-checking, starting with at
least an "or die(mysql_error())" on the query. Also, try running the same
query at the command line to confirm that it's valid.
--
CC