[PHP-DB] 2 selects that return 0 rows one errors one doesn't From: John Guynn (John.Guynn <email protected>)
Date: 09/29/00

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

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>