2 selects that return 0 rows one errors one doesn't

From: Date: Fri, 29 Sep 2000 15:55:14 +0000
Subject: 2 selects that return 0 rows one errors one doesn't
Groups: php.db 
Request: Send a blank email to php-db+get-3173@lists.php.net to get a copy of this message
I have two selects that pull from the same table...both return an empty set but one displays "Warning: Supplied argument is not a valid MySQL result resource in d:\program files\apache group\apache\htdocs/felineguide/winners/dm.php3 on line 25" and the other just displays an empty page. Code follows: This one works like I expect: $sql = "SELECT * from winners WHERE org = 'CFA' and raward != '0' AND ctpe = 'prem' AND region = 'international' ORDER BY raward"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)){ printf ("<img src=\"../images/whitepawprintbutton.gif\" width=\"30\" height=\"35\" alt=\"whitepawprintbutton.gif 30x35\" align=\"AbsMiddle\" border=\"0\"><a href=\"awards.php3?id=%s&org=%s&clas=%s\"> %s Best %s %s - %s %s</a><br>",$row[id],$org,$clas,$place,$clas2,$row[name],$row[color],$row[br eedtit]); } This one returns the error: $sql = "SELECT * from winners WHERE org = 'CFA' AND dmosod = 'DM' ORDER BY breed"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)){ printf ("<img src=\"../images/whitepawprintbutton.gif\" width=\"30\" height=\"35\" alt=\"whitepawprintbutton.gif 30x35\" align=\"AbsMiddle\" border=\"0\"><a href=\"awards.php3?id=%s&org=%s&clas=%s\">%s - %s %s</a><br>",$row[id],$org,dmosod,$row[name],$row[color],$row[breedtit]); } Any ideas? John Guynn

« previous php.db (#3173) next »