Ver Mensaje Individual
  #5 (permalink)  
Antiguo 03/09/2010, 13:11
zapt142
 
Fecha de Ingreso: julio-2010
Ubicación: La Ciudad Blanca, Mérida-Yucatán
Mensajes: 375
Antigüedad: 13 años, 9 meses
Puntos: 7
Respuesta: ¿Como mostrar resultados en columnas con PHPPaging?



En un proyecto en el cual trabaje use este codigo para dividir mi consulta en dos columnas fijate:

Código PHP:
Ver original
  1. <?php  for ($i = 0; $i<count($rows); $i++)
  2.     {
  3.         ?>
  4.           <?php if( $i%2 == 0) {  ?>
  5.           <table width="358" height="167" background="images/fondocatalogo.jpg">
  6.          
  7.        <tr><?php } ?>
  8.           <td width="126" height="161" valign="top">
  9.           <div id="item">
  10.             <div id="item_image" style="padding-left:6px; padding-top:6"><?php if($rows[$i]['imagen']){ ?><img src="images/productos/<?=$rows[$i]["imagen"];?>" width="120" height="112" alt="" /> <?php } else { ?><img src="../admin/icons/img_noimagen.jpg" width="120" height="112" alt="" / ><?php } ?></div>
  11.             <div id="item_price"></div>
  12.             </div>          </td>
  13.           <td width="214" valign="top"><table width="212" border="0" cellpadding="0" cellspacing="0">
  14.             <tr>
  15.               <td width="6">&nbsp;</td>
  16.               <td width="188">&nbsp;</td>
  17.               <td width="18">&nbsp;</td>
  18.             </tr>
  19.             <tr>
  20.               <td>&nbsp;</td>
  21.               <td class="textnegro"><?=$rows[$i]["nombre_prod"];?></td>
  22.               <td>&nbsp;</td>
  23.             </tr>
  24.             <tr>
  25.               <td>&nbsp;</td>
  26.               <td valign="top"><?=$rows[$i]["descripcion_prod"] ?> </td>
  27.               <td>&nbsp;
  28.                 <p>&nbsp;</p></td>
  29.             </tr>
  30.             <tr>
  31.               <td>&nbsp;</td>
  32.               <td valign="top">$<?=$rows[$i]["precio"];?><input name="agregar4" type="submit" id="agregar4" value="Comprar" style="background-image:url(images/btnlogin.jpg);border:none;width:65px;height:22px;color:#ffffff;font-size:11px;" onClick="ajaxpost('cart-ws.php?metodo=addProduct',{id_producto:'<?php echo $rows[$i]["idprod"]; ?>' },'divproductos'); this.disabled = 'disabled'; this.value = 'Agregado';" /></td>
  33.               <td>&nbsp;</td>
  34.             </tr>
  35.           </table>
  36.            </td>
  37.           <td width="10">&nbsp;</td>
  38.           <?php if( ($i+1)%2 == 0) {  ?></tr>
  39.      
  40.           </table><?php } ?>
  41. <?php } ?>//cierra el for

en tu caso creo q seria asi:

Código PHP:
Ver original
  1. <?php if( $i%4 == 0) {  ?>
  2. echo "<tr id=\"movieSeleccion\">"; }
  3.   <?php if( ($i+1)%4 == 0) {  ?> echo "</tr>"; }

cambia el while por un for de esta manera:
Código HTML:
 for ($i = 0; $i<count($datos); $i++)
prueba y comentas
__________________
--No todos aprendemos de la misma forma, ni a la misma velocidad---