![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
10/04/2012, 06:19
|
![Avatar de repara2](http://static.forosdelweb.com/customavatars/avatar369161_2.gif) | | | Fecha de Ingreso: septiembre-2010 Ubicación: München
Mensajes: 2.445
Antigüedad: 14 años, 5 meses Puntos: 331 | |
Respuesta: Visualizar valores de un array en grupos
Código PHP:
Ver original<?php $resultados = array(1,2,3,2,3,4,5,4,5,6,7,6,5,4,5,4,3,4,5,6,7,8,9,0); $pagina = 5; $table = "<table>"; for($i=0;$i<count($resultados);$i += $pagina) { $table .= "<tr bgcolor='#CCCCCC'>"; for($j = 0; $j<$pagina; $j++) { if(array_key_exists(($i+$j), $resultados))$table .= "<td >{$resultados[$i+$j]}</td>"; else $table .= "<td ></td>"; } $table .= "</tr>"; } $table .= "</table>"; echo $table; ?>
__________________ Fere libenter homines, id quod volunt, credunt. |