Displaing mySQL record tutorial

I was reading through this tutorial:
http://www.kirupa.com/web/sqlrecords_php2.htm

and I don’t really get what this line does:


$i = 0;
while($result_ar = mysql_fetch_assoc($result)){
?>
< tr <?php if($i%2 == 1){ 
echo "class='body2'";
}else{ 
echo "class='body1'";}?>>

I don’t see how $i will ever change, beause nothing tells it to add a value or anything, so when it comes to $i%2, it will always equal the same number won’t it?

Also, is $result_ar a variable created by the scripter, or is there automatically a variable like this once array values are stored into $result ?

Thanks