hi this is bit difficult to me do this i need idea how i can able to do in php how i can use loop to write this complicated nested loop php <tr> <td></td> <td></td> </tr> <tr class="alt"> <td></td> <td></td> </tr>
Kind-of guessing at what you're asking, since that's not really 'complicated' -- and it's hard to say without the data. Are you just asking how to alternate the class on the TR? or how to populate those TD? What's the DATA? Without that we have no clue what you are looping (I almost asked "what loops?!?) or where... do you want to loop just the TR, the TR and the TD?
May be something link this for($i=0 ; $i < $cnt_tr ; $i++) { echo '<tr'; if($class[$i]) echo ' class="'.$class[$i].'"'; echo '>'; for($j=0 ; $j < $cnt_td ; $j++) { echo '<td></td>'; } echo '</tr>'; } Code (markup):
i think the ts ment something like this. $items = 100; for ($loops = 0; $loops < $items; $loops++) { echo '<tr' . (($loops % 2) ? ' class="odd"' : '') . '>'; echo '<td>data1</td><td>data2</td>'; echo '</tr>'; } PHP: Yes?