I've been working on some code to award badges to teachers based on how many items they upload to share with their colleagues and students.
I've run into a problem when the array is empty. Nothing shows up.
I tried an empty() function, but I must have put it in the wrong position, because then it started appearing for users who had uploads.
So essentially in the code below, it's the "if $uploads < 1" section that I'm having difficulty with.
..and the resultant question is how do I get a message to echo where mysql_fetch_array($upload_count) is empty?
     <?php
$total_uploads = mysql_query("SELECT members.member_id, members.member_firstname,           members.member_lastname, COUNT(*)  
FROM uploads    
JOIN members
ON uploads.member_id = members.member_id
GROUP BY uploads.member_id   ");
$total_uploads_count    = @mysql_num_rows($total_uploads);
$upload_count = mysql_query("SELECT members.member_id, members.member_firstname,  members.member_lastname, COUNT(*)  
FROM uploads    
JOIN members
ON uploads.member_id = members.member_id AND members.member_id = ".     $_SESSION['member_id']  . "
GROUP BY uploads.member_id   ");
while($row_count=mysql_fetch_array($upload_count))  
{  
$uploads =  $row_count['COUNT(*)'];
 $unlock2 = 5 - $row_count['COUNT(*)'] ;
 $unlock3 = 20 - $row_count['COUNT(*)'] ;
 $unlock4 = 50 - $row_count['COUNT(*)'] ;
 $unlock5 = 100 - $row_count['COUNT(*)'] ;
 $unlock6 = 200 - $row_count['COUNT(*)'] ;           
 echo " you have <span class =\"blue_inherit\"> $uploads </span> uploads.<br/><br/>";
 if  ($uploads  < 1 )
 {
echo "Upload a resource to share in order to unlock your novice uploader badge!<br/>
 <img src=\"images/badges/badge_e_share_1_locked.png\" width=\"200\" height=\"200\" alt=\"Sharing Badge\" />";
 }
    else if  ($uploads >= 1 && ($uploads < 5 ))
 {
echo "Well done, you've unlocked your novice sharer's badge. <br/>
 <img src=\"images/badges/badge_e_share_1.png\" width=\"200\" height=\"200\" alt=\"Sharing Badge\" /><br/>
 If you upload $unlock2 more resources, you can unlock your E-sharing advanced beginner's badge. <br/>
  <img src=\"images/badges/badge_e_share_2_locked.png\" width=\"200\" height=\"200\" alt=\"Sharing Badge\" /><br/>
 ";
 }
    else if  ($uploads >= 5 && ($uploads < 20 ))
 {
echo "Well done, you've unlocked your E-sharing advanced beginner's badge. <br/>
 <img src=\"images/badges/badge_e_share_2.png\" width=\"200\" height=\"200\" alt=\"Sharing Badge\" /><br/>
 If you upload $unlock3 more resources, you can unlock your E-sharing mini-hero badge. <br/>
  <img src=\"images/badges/badge_e_share_3_locked.png\" width=\"200\" height=\"200\" alt=\"Sharing Badge\" /><br/> ";
 }
else if  ($uploads >= 20 && ($uploads < 50 ))
 {
echo "Well done, you've unlocked your E-sharing mini-hero badge. <br/>
 <img src=\"images/badges/badge_e_share_3.png\" width=\"200\" height=\"200\" alt=\"Sharing Badge\" /><br/>
 If you upload $unlock4 more resources, you can unlock your E-sharing hero badge. <br/>
  <img src=\"images/badges/badge_e_share_4_locked.png\" width=\"200\" height=\"200\" alt=\"Sharing Badge\" /><br/> ";
 }   
else if  ($uploads >= 50 && ($uploads < 100 ))
 {
echo "Well done, you've unlocked your E-sharing hero badge. <br/>
 <img src=\"images/badges/badge_e_share_4.png\" width=\"200\" height=\"200\" alt=\"Sharing Badge\" /><br/>
 If you upload $unlock5 more resources, you can unlock your E-sharing super-hero badge. <br/>
  <img src=\"images/badges/badge_e_share_5_locked.png\" width=\"200\" height=\"200\" alt=\"Sharing Badge\" /><br/> ";
 }       
else if  ($uploads >= 100 && ($uploads < 200 ))
 {
echo "Well done, you've unlocked your E-sharing super-hero badge. <br/>
 <img src=\"images/badges/badge_e_share_5.png\" width=\"200\" height=\"200\" alt=\"Sharing Badge\" /><br/>
 If you upload $unlock6 more resources, you can unlock your E-sharing Guru badge. <br/>
  <img src=\"images/badges/badge_e_share_6_locked.png\" width=\"200\" height=\"200\" alt=\"Sharing Badge\" /><br/> ";
 }           
 else 
 {
    echo "You've now a Guru!! <br/>
      <img src=\"images/badges/badge_e_share_6.png\" width=\"200\" height=\"200\" alt=\"Sharing Badge\" /><br/> ";
 }
     }  
 ?>
 
     
    