# Displaing mySQL record tutorial

**URL:** https://forum.kirupa.com/t/displaing-mysql-record-tutorial/128499
**Category:** Uncategorized
**Created:** [November 13, 2004, 2:55am UTC](https://forum.kirupa.com/t/displaing-mysql-record-tutorial/128499 "2004-11-13T02:55:20Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![blah\_de\_blah](https://avatars.discourse-cdn.com/v4/letter/b/a8b319/32.png) [@blah\_de\_blah](https://forum.kirupa.com/u/blah_de_blah)
#### Post date: [November 13, 2004, 2:55am UTC](https://forum.kirupa.com/t/displaing-mysql-record-tutorial/128499/1 "2004-11-13T02:55:20Z")

</div>

I was reading through this tutorial:  
[http://www.kirupa.com/web/sqlrecords\_php2.htm](http://www.kirupa.com/web/sqlrecords_php2.htm)

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

```php

$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
