Re: Re: Supplied argument is not a valid MySQL result

From: Date: Thu, 15 Nov 2001 21:05:59 +0000
Subject: Re: Re: Supplied argument is not a valid MySQL result
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-74793@lists.php.net to get a copy of this message
Got it to work. I had made a change that deleted something, not sure what, but when I went back a revision it worked, and I just added back in the html that I needed to use, but I was more careful. --- Richard Lynch <ceo@l-i-e.com> wrote: > 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: 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 > ===== Dan McCullough ------------------------------------------------------------------- "Theres no such thing as a problem unless the servers are on fire!" h: 603.444.9808 w: McCullough Family w: At Work __________________________________________________ Do You Yahoo!? Find the one for you at Yahoo! Personals http://personals.yahoo.com

« previous php.general (#74793) next »