Foros del Web » Programando para Internet » PHP »

mysql_fetch_array -Forma horizontal

Estas en el tema de mysql_fetch_array -Forma horizontal en el foro de PHP en Foros del Web. Hola gentita estoy en pininos de php, como haria para mostrar un array en forma horizontal, dejo el codigo. <?php include("cn.php"); $consulta=mysql_query("select *from productos", $conexion); ...
  #1 (permalink)  
Antiguo 26/05/2010, 08:07
Avatar de frankjoel86  
Fecha de Ingreso: noviembre-2008
Ubicación: Ica
Mensajes: 295
Antigüedad: 15 años, 5 meses
Puntos: 0
Sonrisa mysql_fetch_array -Forma horizontal

Hola gentita estoy en pininos de php, como haria para mostrar un array en forma horizontal, dejo el codigo.

<?php
include("cn.php");
$consulta=mysql_query("select *from productos", $conexion);
while($campo=mysql_fetch_array($consulta)){
?>

<table width="617" border="1" align="center">
<tr><th colspan="5" scope="col"><table width="336" border="1">
<tr><th width="104" scope="col"><table width="101" border="0" align="left">
<tr>
<th width="45" scope="col" bgcolor="#CCCCCC">Modelo</th>
<th width="46" scope="col" bgcolor="#CCCCCC">Precio</th>
</tr>
<tr>
<th scope="row"><?php echo $campo[descripcion]?></th>
<td><?php echo $campo[precio]?></td>
</tr>
<tr>
<th colspan="2" scope="row"><?php echo "<img src=$campo[img]>" ?></th>
</tr>
<tr>
<th scope="row"><img src="images/detalles.gif" width="71" height="19"></th>
<td><em><a href=""><img src="images/comprar.gif" width="70" height="19"></a></td>
</tr>
</table></th>
<th width="105" scope="col"><table width="101" border="0" align="left">
<tr>
<th width="45" scope="col">Modelo</th>
<th width="46" scope="col">Precio</th>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>&nbsp;</td>
</tr>
<tr>
<th colspan="2" scope="row">&nbsp;</th>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>&nbsp;</td>
</tr>
</table></th>
<th width="105" scope="col"><table width="101" border="0" align="left">
<tr>
<th width="45" scope="col">Modelo</th>
<th width="46" scope="col">Precio</th>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>&nbsp;</td>
</tr>
<tr>
<th colspan="2" scope="row">&nbsp;</th>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>&nbsp;</td>
</tr>
</table></th>
</tr>

</table></th>
</tr>
</table>
<?php
}
?>
*Aparece el primer producto en la 1ra celda, el segundo producto abajo, COMO AHORIA PARA QUE EL 2do producto aparesca al lado derecho de la 1ra celda y no abajo.

* se agradece cualquier ayuda.
  #2 (permalink)  
Antiguo 26/05/2010, 08:27
Avatar de cemansilla  
Fecha de Ingreso: septiembre-2007
Ubicación: Buenos Aires, Argentina, Argentina
Mensajes: 214
Antigüedad: 16 años, 7 meses
Puntos: 6
Respuesta: mysql_fetch_array -Forma horizontal

Eso es de HTML, vos tendrías algo así:

Código HTML:
<tr>
    <td>fila 1 columna 1</td>
</tr>
<tr>
    <td>fila 2 columna 1</td>
</tr> 
Y tendrías que pasar a algo así:

Código HTML:
<tr>
    <td>fila 1 columna 1</td>
    <td>fila 1 columna 2</td>
</tr> 
Saludos!
__________________
CÉSAR MANSILLA
Web & Mobile Developer - Analista - Creativo - Curioso
http://cesarmansilla.com/
http://cesarmansilla.com/blog/

Etiquetas: horizontal, formulario
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:01.