Ver Mensaje Individual
  #3 (permalink)  
Antiguo 27/09/2011, 08:20
Avatar de arielcasanova
arielcasanova
 
Fecha de Ingreso: octubre-2004
Ubicación: Bahía Blanca - Argentina
Mensajes: 332
Antigüedad: 19 años, 6 meses
Puntos: 1
Respuesta: Cómo ordenrar resultados en columnas en una tabla html

Flashback, gracias por tu respuesta, pero creo que no me has entendido bien. De todos modos, seguí avanzando y llegué hasta esto, que no me funciona, pero me parece mejor orientado.

Código:
<?php
$sql = "Select *, est.nombre as nombre_em from ambiental_fichas_sectores sec
	  inner join ambiental_fichas_estaciones est on
	  sec.id=est.id_sector where sec.id_ficha='2'
	  order by est.nombre";
$result=mysql_query($sql, $conexion);
$cantidad= mysql_num_rows($result);

if ($cantidad<=18) 
{?>
 <div style="width:150px; float:left;">
 <table border="1" width="150">
 <tr>
 <td width="50">EM</td>
 <td width="50">AE</td>
 <td width="50">TD</td>
 </tr>
<?php
$cons1 = 
	"Select *, est.nombre as nombre_em from ambiental_fichas_sectores sec
	  inner join ambiental_fichas_estaciones est on
	  sec.id=est.id_sector where sec.id_ficha='2'
	  order by est.nombre";
 $rs[0]=mysql_query($cons1, $conexion); 
 
 
for ($i = 1; $i<= 18; $i++)
{
    $reg1 = mysql_fetch_array($rs[$consultas]);
?>
    <tr>
        <td><?php echo $reg1['nombre_em']; ?></td>
        <td> </td>
        <td> </td>
    </tr>
<?php 
}
?>
</table>
</div>
<?php 
	  
}
else
{
$consultas=ceil(($cantidad/18)); 
for ($i = 0; $i<= $consultas; $i++)
?>
 <div style="width:150px; float:left;">
 <table border="1" width="150">
 <tr>
 <td width="50">EM</td>
 <td width="50">AE</td>
 <td width="50">TD</td>
 </tr>
<?php 
$limit=(18*$consultas);
$limit2=((18*$consultas)+18); 
$limit3="$limit, $limit2"; 
$cons[$consultas] = "Select *, est.nombre as nombre_em from
ambiental_fichas_sectores sec
       inner join ambiental_fichas_estaciones est on
       sec.id=est.id_sector where sec.id_ficha='2'
       order by est.nombre limit $limit3";
 $rs[$consultas]=mysql_query($cons[$consultas], $conexion); 




 
for ($i = 1; $i<= 18; $i++)
{
    $reg1 = mysql_fetch_array($rs[$consultas]);
?>
    <tr>
        <td><?php echo $reg1['nombre_em']; ?></td>
        <td> </td>
        <td> </td>
    </tr>
<?php 
}
?>
</table>
</div>
<?php } ?>
__________________
Ariel Casanova
diseño y desarrollo web estratégico
www.emporia.com.ar