title: If total is between two numbers echo statement, else if between different set of numbers echo a different statement, etc
body: <p><B>Answered</b><br>
  I was able to get this to work using the example posted by Glavić. Thank you everyone for your tips, they are all very useful.</p>
  
  <p><b>Original Question</B><br>
  I am terrible with figuring out if/else statements. I have looked at multiple tutorials and just can't get what I'm trying to do work. I need this:
  If total amount of points is less than # state that no title is achieved
  If total amount is between # and # state what title that would be
  If total amount is between higher # and # state what title that would be
  etc.</p>
  
  <p>The adding of total points works just fine but I can't figure out how to get the correct title for the total points to show. I have included the code for getting totalpoints as well in case it can be combined with what I am trying to do. Any help greatly appreciated</p>
  
  <p>This works just fine:</p>
  
  <pre><code>&lt;?php
  $query = "SELECT points, SUM(points) AS totalpoints FROM competition WHERE id = $id"; 
  $result = mysql_query($query) or die(mysql_error());
  
  while($row = mysql_fetch_array($result)){
      echo "&lt;b&gt;";
      echo $row['totalpoints'];
      echo "pts&lt;/b&gt;";
  }?&gt;
  </code></pre>
  
  <p>This does not work:
  (it says Hall of Fame regardless of what the point total is)</p>
  
  <pre><code>&lt;?php
  $query = "SELECT points, SUM(points) AS totalpoints FROM competition WHERE id = $id"; 
  $result = mysql_query($query) or die(mysql_error());
  
  while($titled = mysql_fetch_array($result)) {
  
  if ($titled &lt;= 999)
   {echo ", not titled";}
  
  elseif (($titled == 1000) &amp;&amp; ($titled &lt;= 1999)) 
   {echo ", Champion";}
  
  elseif (($titled &gt;= 2000) &amp;&amp; ($titled &lt;= 2999)) 
   {echo ", Grand Champion";}
  
  elseif (($titled &gt;= 3000) &amp;&amp; ($titled &lt;= 3999)) 
   {echo ", Honor Champion";}
  
  elseif (($titled &gt;= 4000) &amp;&amp; ($titled &lt;= 5999)) 
   {echo ", Regional Champion";}
  
  elseif (($titled &gt;= 6000) &amp;&amp; ($titled &lt;= 7999)) 
   {echo ", State Champion";}
  
  elseif (($titled &gt;= 8000) &amp;&amp; ($titled &lt;= 9999)) 
   {echo ", National Champion";}
  
  elseif (($titled &gt;= 10000) &amp;&amp; ($titled &lt;= 19999)) 
   {echo ", World Champion";}
  
  elseif ($titled &gt;= 20000) 
   {echo ", Hall of Fame";}
  
  }?&gt;
  </code></pre>