Re: Supplied argument is not a valid MySQL result resource

From: Date: Thu, 08 Nov 2001 15:39:25 +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-73889@lists.php.net to get a copy of this message
You should change your sql statement so that you have single quotes around the $gi variable. Like this: $sqlf = "SELECT * FROM products WHERE collection_id = $id AND group_image = '$gi' ORDER BY sort_order ASC"; I am going to assume that collection_id is an integer, so the quote isn't necessary there, but since group_image is a character/string value, you need to enclode it in quotes. HTH Sam Masiello Software Quality Assurance Engineer Synacor (716) 853-1362 X289 smasiello@synacor.com ----- Original Message ----- From: "Dan McCullough" <McWC@rocketmail.com> To: "PHP General List" <php-general@lists.php.net> Sent: Thursday, November 08, 2001 10:42 AM Subject: [PHP] Supplied argument is not a valid MySQL result resource > 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 > > __________________________________________________ > Do You Yahoo!? > Find a job, post your resume. > http://careers.yahoo.com > > -- > 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 >

« previous php.general (#73889) next »