I would do a mysql_num_row(); on your results to see if it returning
anything at all.

Jim
----- Original Message -----
From: "Jay Fitzgerald" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Tuesday, December 18, 2001 12:08 PM
Subject: [PHP-DB] while...if statements???


> Does anyone know why this isn't working?? What I am trying to do is
display
> photos from a database based on each month. This part works fine when I
set
> it to the current month of December (today) as that is when I uploaded the
> photos.
>
> However, when I manually set the date to a month that has no photos in it,
> I want it to echo the No Animals string below....This is only working
> half-way...meaning that it will display a blank page with nothing on it
> instead of actually echoing the No Animals string....
>
> Can anyone please help?? Is there really a way to have a "while...if"
> statement????
>
>
>
> ========<CODE>=========
> <?
> $connection = mysql_connect($hostname, $user, $pass) or die ("Unable to
> connect!");
> $query = "SELECT petname, petDesc, petpicture FROM petinfo WHERE petmonth
=
> 'Apr'";
> $result = mysql_db_query($database, $query, $connection) or die ("Error in
> query: $query. " . mysql_error());
>
> while (list($pet_name, $pet_Desc, $pet_picture) =
mysql_fetch_row($result))
> {
> if ($pet_picture == "")
> {
> echo "No Animals have been posted for $date at this moment. Please check
> back soon.";
> exit;
> }
>
> else
> {
> echo "
> <FONT FACE=\"Arial, Helvetica\"><B>Pet of the month</B></FONT><BR>
>
> <BR>
> <IMG
>
SRC=\"http://moss.bayou.com:8888/oppj/admin/animalcontrol/photos/$pet_pictur
e\"
> HEIGHT=150><BR>
>
> <BR>
> <FONT FACE=\"Arial, Helvetica\" SIZE=\"-1\">$pet_Desc<BR>
>
> <BR>
> To adopt $pet_name please visit the Ouachita Parish Animal Shelter.<BR>
> The adoption fee is \$50.00 which includes Spade, Neutering and 7-N-1
> Shot.<BR>
>
> <BR>
> Sorry, we can not hold $pet_name for you (First come first serve
> basis).</FONT>
> <BR><BR>";
> }
> }
> ?>
> ========</CODE>=========
>
> Thanks,
>
>
> Confus3d
>
>
>
> --
> PHP Database 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]
>
>


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