Managing Multiple Conditions in a MySQL Query
| From: | Mike Gifford | Date: | Wed, 02 May 2001 05:30:45 +0000 |
| Subject: | Managing Multiple Conditions in a MySQL Query | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-51079@lists.php.net to get a copy of this message | ||
Hello,
I'd like to verify two conditions are true in the results that I pull out of my MySQL database. In this case I wanted Verified and Public both to be listed as 'yes' in the DB before they were displayed. The code I tried to use is as follows:
<?php
echo "<p>Recent Signatures\n<br><em><UL>";
$individuals_query = mysql_query("SELECT FirstName,LastName,CityState FROM phPetition WHERE Public='yes',Verified='yes' ORDER BY ID DESC LIMIT 0,5");
while ($individuals_array = mysql_fetch_array($individuals_query)) {
echo "<LI>" . stripslashes($individuals_array["FirstName"]) . " " . stripslashes($individuals_array["LastName"]) . " from " . stripslashes($individuals_array["CityState"]);
}
However, it gave me the following error:
Warning: Supplied argument is not a valid MySQL result resource in /usr/local/rabble/petition/index.php3 on line 89
How do I get around this?
Mike
--
Mike Gifford, OpenConcept Consulting, http://openconcept.ca
Offering everything your organization needs for an effective web site.
Featured Client: http://rabble.ca - News For the Rest of Us!
Courage my friends, 'tis not too late to make a better world - T. Douglas