I have the following code that gets all escorts that are featured. What I want to add is if there are no escorts that are featured show my image say youradhere.jpg 5 times since I'm limiting the results to 5. I would apprecaite any help or ideas on this.. AND YES 🙂 ITS AN INTERESTING WEBSITE...

$queryfeatured = mysql_query("SELECT * FROM userinfo, user WHERE (userinfo.category1='Female Escorts' OR userinfo.category2='Female Escorts') $paypalstatus AND userinfo.status='Approved' AND userinfo.id = user.id AND userinfo.featured='Yes' GROUP BY user.id LIMIT 5");
while ($getfeatured = mysql_fetch_array($queryfeatured)){
$getimgs = mysql_query("SELECT * FROM images WHERE id=$getfeatured[id] AND status='Approved' GROUP BY thumb ORDER BY RAND() LIMIT 1");
$imgsfetch = mysql_fetch_assoc($getimgs);
echo "  ";
echo "<a href=\"$sitefilestartname"."-female-escorts.php?username=$getfeatured[username]\"><font size=\"2\" face=\"serif\"><img src='" . "http://www.mysite.com/customerimages/thumb/" . $imgsfetch['thumb'] . "' alt=\"$getfeatured[username]\"></a>";
}
    kpowning wrote:

    I have the following code that gets all escorts that are featured. What I want to add is if there are no escorts that are featured show my image say youradhere.jpg 5 times since I'm limiting the results to 5. I would apprecaite any help or ideas on this.. AND YES 🙂 ITS AN INTERESTING WEBSITE...

    $queryfeatured = mysql_query("SELECT * FROM userinfo, user WHERE (userinfo.category1='Female Escorts' OR userinfo.category2='Female Escorts') $paypalstatus AND userinfo.status='Approved' AND userinfo.id = user.id AND userinfo.featured='Yes' GROUP BY user.id LIMIT 5");
    while ($getfeatured = mysql_fetch_array($queryfeatured)){
    $getimgs = mysql_query("SELECT * FROM images WHERE id=$getfeatured[id] AND status='Approved' GROUP BY thumb ORDER BY RAND() LIMIT 1");
    $imgsfetch = mysql_fetch_assoc($getimgs);
    echo "&nbsp;&nbsp;";
    echo "<a href=\"$sitefilestartname"."-female-escorts.php?username=$getfeatured[username]\"><font size=\"2\" face=\"serif\"><img src='" . "http://www.mysite.com/customerimages/thumb/" . $imgsfetch['thumb'] . "' alt=\"$getfeatured[username]\"></a>";
    }
    

    here's a hint:

    $youradherecount=5-count($queryfeatured);

      Im still confused.. Sorry are you talking about integrating a loop? An example would be much appreciated.

        for ($i=count($queryfeatured);$i<5;$i++;){
        echo "<img src=youradhere.jpg>";
        }
        

        Check to see if you need to post in the newbies forum.

          Thanks for the help... How about Ive been working on nothing but scripting all weekend and I really cant think anymore..

            Write a Reply...