how to add the class="last" to the last line in the loop
<p>the above is form the database, which used the LIMIT 0, 10.($result)</p>

<pre><code>         while ($row = mysql_fetch_object($result)){
                   echo '&lt;li&gt;'.$row-&gt;title.'&lt;/li&gt;';
          }
</code></pre>

<p>now i want to add the class="last" to the 10 line. this is my ways. but it can't work. how to correct it or using another way to get that?</p>

<pre><code>  while ($row = mysql_fetch_object($result)){
      $num=0;
      if($num==9){
                   echo '&lt;li class="last"&gt;'.$row-&gt;title'&lt;/li&gt;';
          }else{ echo '&lt;li&gt;'.$row-&gt;title.'&lt;/li&gt;';}
       $num++;
     }
</code></pre>
