Ver Mensaje Individual
  #5 (permalink)  
Antiguo 01/02/2013, 13:59
Avatar de GatorV
GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Respuesta: mostrar imagenes de bd en galeria dinamica

Solo es necesario que vayas contando cuantas filas haz impreso, no es necesario que hagas dos ciclos:
Código PHP:
Ver original
  1. <?php
  2.  
  3. echo '<table><tr>';
  4. $cellCount = 0;
  5. $cellLimit = 4;
  6. while($row = mysql_fetch_array($result)) {
  7.     $cellCount++;
  8.     echo '<td><img src="' . $row['src'] . '"></td>';
  9.     if ($cellCount == $cellLimit) {
  10.         echo '</tr><tr>';
  11.         $cellCount = 0;
  12.     }
  13. }
  14. echo '</tr></table>';

Saludos.