Ver Mensaje Individual
  #5 (permalink)  
Antiguo 27/09/2011, 08:57
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

ya lo resolví
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='$id_ficha'
	  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='$id_ficha'
	  order by est.nombre";
 $rs=mysql_query($cons1, $conexion); 
if ($row = mysql_fetch_array($rs))
{ 
mysql_field_seek($rs,0); 
do 
{ 
?>
    <tr>
        <td><?php echo $row['nombre_em']; ?></td>
        <td> </td>
        <td> </td>
    </tr>
	
<?php
} 
while ($row = mysql_fetch_array($rs)); 
}
?>	
</table>
</div><?php
	  
}
else
{

$consultas=floor(($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 
if ($limit=="") { $limit="0"; } else { $limit=$limit+18;}
$limit2=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.id limit $limit3";
$rs[$consultas]=mysql_query($cons[$consultas], $conexion);  
if ($row = mysql_fetch_array($rs[$consultas]))
{ 
mysql_field_seek($rs[$consultas],0); 
do 
{ 
?>
    <tr>
        <td><?php echo $row['nombre_em']; ?></td>
        <td> </td>
        <td> </td>
    </tr>
	
<?php
} 
while ($row = mysql_fetch_array($rs[$consultas])); 
}
?>	
</table>
</div>
<?php } 






}
?>
__________________
Ariel Casanova
diseño y desarrollo web estratégico
www.emporia.com.ar