Dan McCullough wrote: > Warning: Supplied argument is not a valid MySQL result resource in > /home/sites/projects.heathermccullough.com/web/copeland/product.php on > line 61 > > Here is the code, I fixed it once, and I cant figure out why it keeps > returning. > > if ($submit) { > $sql = ("SELECT * FROM store WHERE state = '$State' AND groups = > '$group_id'");
The ()s here are kinda silly... They tell PHP to evaluate the string before anything else in the expression, and there ain't anything else in the expression... It's like saying: $foo = (2 + 3); Doesn't hurt anything, but you look a bit silly... > $result = mysql_query($sql); Add some code to the end of this line. At a minimum, use ... or die(mysql_error()); That's actually not so good on a production server, as it will present icky error messages to end users, some of whom might be hackers who then know more than they should about the internal working of your page/database/site... So, better is: ... or error_log(__FILE__ . ' ' . __LINE__ . ': ' . mysql_error()); only now you'll have to do the following in a shell prompt: tail /usr/local/apache/logs/error_log to see your error message. > if(mysql_num_rows($result) > 0) { < - line 61 > while ($stores = mysql_fetch_array($result) ) { > $store_name .= "".$stores["name"]." <br> ".$stores["address"]." <br> > ".$stores["city"].", ".$stores["state"]." > ".$stores["zip"]."<br>".$stores["phone"]." <br><br> "; } > } else { > $store_name .= "Copeland Furniture Company Store<br>Main > Street<br>Bradford, Vermont 05033<br>802-222-5300<br><a > href=\"http://www.copelandfurniture.com/companystore\" > target=\"new\">Copeland Furniture Company Store</a>"; } > MYSQL_CLOSE(); -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]