prova qualcosa del genere
Dove $my_array è l'array contenente i dati che vuoi mostrare, $divide è il numero di dati per riga.codice:<?php $my_array = array("Ciao", "Mamma", "Guarda", "Come", "Mi", "Diverto", "...", "Questo", "Esemprio", "Fa", "Proprio", "Pena,", "Scusate!"); $divide = 3; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <table border="1" cellpadding="10" cellspacing="10"> <?php for ($j = 0; $j <= floor(count($my_array)/$divide); $j++) { ?> <tr> <?php for ($i = $j*$divide; $i < ($j+1)*$divide && $i < count($my_array); $i++) { ?> <td bordercolor="#999999" ><?php echo($my_array[$i]);?></td> <?php } ?> </tr> <?php } ?> </table> </body> </html>
![]()

Rispondi quotando