I have a site where my members upload headshots of themselves. Not all members have uploaded a headshot so instead of the red X being displayed, I made a .jpg thats says "No Pic Avail". On my site is a Featured Comics page where I wrote the script, simply to randomly choose a member. Problem is, sometimes a comic with no headshot appears and my .jpg "No Pic Avail" is displayed. That has turned off my visitors. What is the best way to have the script redo the query if it finds a comic with no head shot. In the database there is a field called PIC_URL. If no headshot is in there, by default the entry is "/comicpics/noavail.jpg". Here is what I wrote (without the IF statement)
$sql = "SELECT * FROM comicprofile order by rand() limit 1";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
$F_NAME=$myrow[F_NAME];
$L_NAME=$myrow[L_NAME];
$CITY=$myrow[CITY];
$STATE=$myrow[STATE];
$PIC_URL=$myrow[PIC_URL];
$USERNAME=$myrow[USERNAME];
$RATING=$myrow[RATING];
Or you can see it in action at www.standupcomicsonline.com/featuredcomic.php
If a headshot appears, refresh until you see the NoPic Avail graphic.
Thanks!
Mike