this is my code it echos images in <td> Now,if i want it to make new <tr> if the <td> is becoming more than 3 ex:i have 6 images,using this code will show me them under eachother but i want every <tr>to have only 3 <td> and then if the number of images increase more than 3,it make new <tr> to the rest of the images what can i do???? $sql=mysql_query("Select * from clients"); <tr> <?php do { ?> <td> <a href="client_view.php?client_images_id=<?php echo $row_Recordset1['client_images_id']; ?>"><img src="Admin/<?php echo $row_Recordset1['client_images_fotos']; ?>" width="170" height="170"> </a> </td> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> </tr> PHP:
thnxxxx i found the answer ,check it <?php $cols = 3; $counter = 1; while($row_Recordset1 = mysql_fetch_assoc($Recordset1)){?> <td> <a href="client_view.php?client_images_id=<?php echo $row_Recordset1['client_images_id']; ?>" <img src="Admin/<?php echo $row_Recordset1['client_images_fotos']; ?>" width="170" height="170"></a> </td> <?php if($counter % $cols == 0) echo '</tr><tr>'; $counter++; }?> </tr> </table> PHP: