Well, first of all, you can start by getting friendly with "print
mysql_error();", which will tell you if you have any syntax errors in your
SQL statement. =D

And I think you do. That should be:
  ...WHERE Public='yes' AND Verified='yes'...

As opposed to:
  ...WHERE Public='yes',Verified='yes'...

Additionally, you're passing your results directly to a while loop, which
is a something of a no-no.  Even if your SQL statement is perfectly
formatted, you'll generate a warning if the number of rows returned is
zero.


   Sam Leibowitz ([EMAIL PROTECTED])
   Project Manager
   Business Technology Center (http://www.btcwcu.org)


On Wed, 2 May 2001, Mike Gifford wrote:

> 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
> 
> 


-- 
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]

Reply via email to