Re: Newbie alert: supplied argument is not a valid MySQL result resource
| From: | Niel Archer | Date: | Tue, 10 Jul 2007 03:57:05 +0000 |
| Subject: | Re: Newbie alert: supplied argument is not a valid MySQL result resource | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-43766@lists.php.net to get a copy of this message | ||
Hi
On my way to bed so too tired too look closely, but at a guess I'd say
it's a logic error. I would guess this:
> $sid = mysql_fetch_array($query) || die ('Could not fetch from database:
> ' . mysql_error()); // <--- line 49
isn't evaluating in the order you expect.. You're using a logic
statement as an assignment, and the result of that get's assigned to your
variable not the resource you expect. Try it like this to see if it works:
$sid = mysql_fetch_array($query);
if ($sid === false) die ('Could not fetch from database: ' . mysql_error());
If that's not the problem, I haven't got a clue until after sleep and
coffee.
Niel