Re: Supplied argument is not a valid MySQL result resource
| From: | Chris O'Brien | Date: | Thu, 08 Nov 2001 15:45:32 +0000 |
| Subject: | Re: Supplied argument is not a valid MySQL result resource | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-73893@lists.php.net to get a copy of this message | ||
> Why isn't this a valid argument, does it have to do with the AND statement?
>
> $gi = "Y";
> $sqlf = "SELECT * FROM products WHERE collection_id = $id AND group_image =
> $gi ORDER BY
> sort_order ASC";
> $resultf = mysql_query($sqlf);
> while ($group_images = mysql_fetch_array($resultf)) {
> $list_images .= "<a
> href=test3.php?id=".$group_images["prod_id"]."><img
> src=\"images/product/".$group_images["product_image"]."\"
> border=\"0\"
>
> alt=\"".$group_images["product_name"]."\"></a><br>";
> }
>
> dan
>
You should try quoting the variables in the query, like so:
$sqlf = "SELECT * FROM products WHERE collection_id = '$id' AND group_image
= '$gi' ORDER BY sort_order ASC";
* Chris O'Brien (clobrien@excel.net)
* Excel.Net,Inc. - http://www.excel.net/
* (920) 452-0455 - Sheboygan/Plymouth area
* (888) 489-9995 - Other areas, toll-free