Ver Mensaje Individual
  #11 (permalink)  
Antiguo 04/09/2012, 18:11
drieraperez
 
Fecha de Ingreso: junio-2012
Mensajes: 14
Antigüedad: 11 años, 10 meses
Puntos: 0
Respuesta: Nueva Línea en tabla cuando sobrepase X registros

Cita:
Iniciado por Gerwal Ver Mensaje
si me equivoque yo como lo hice muy rapido

Código PHP:
<?php $result mysql_query("SELECT * FROM articulos"); 
                 
//agrego contador ---- 
                
$i=0;
        if (
$row mysql_fetch_array($result)){ 
        echo 
"<table border = '0' width='100%' class = 'altrowstable' id = 'alternatecolor'> \n"
               echo 
"<tr>";
               do { 
                      echo 
"<td><img src='./imagenes/articulos/".$row['imagen']."' width='150px' ></td> \n"
                      
//le sumo 1 ---- 
                     
$i++;
                 if(
$i%4==0){
                          
//si el residuo es 0 cierra y abre el td
                          
echo "</td><td>";
                  }
               } while (
$row mysql_fetch_array($result)); 
           echo 
"</tr></table> \n"
         } else { 
        echo 
"No se han encontrado artículos"
        } 
        
?>

Funciona! Muchas Gracias! Te debo una :)