Ver Mensaje Individual
  #2 (permalink)  
Antiguo 23/01/2012, 12:31
Avatar de linuxzero
linuxzero
 
Fecha de Ingreso: noviembre-2011
Ubicación: Argentina
Mensajes: 778
Antigüedad: 12 años, 5 meses
Puntos: 160
Respuesta: Imprimir consulta sql en php con una tabla

Podes probar asi:

Código PHP:
Ver original
  1. <table cellpadding="0" cellspacing="0" width="751" height="169">
  2.  
  3. <?
  4.         $resulttag = mysql_query('SELECT * FROM tags WHERE id_usuario=\''.$idrow.'\'');
  5.         $i = 0;
  6.         while ($tagg = mysql_fetch_row($resulttag)){
  7.                
  8.                 // Si es impar, empiezo fila
  9.                 if ($i % 2 != 0) {
  10.                        echo "<tr>";
  11.                        echo "<td valign='middle' height='130' background='colortags/" . $tagg[2] . ".png'>" . $tagg[3] . "</td>";            
  12.                  } else {
  13.                        // Si es par, agrego columna par y cierro fila
  14.                        echo "<td valign='middle' height='130' background='colortags/" . $tagg[2] . ".png'>" .
  15.                        echo "</tr>";
  16.                        echo "<tr>";
  17.                        echo"<td width='357'>&nbsp;</td>
  18.                                 <td width='37'>&nbsp;</td>
  19.                                 <td height='39' width='357'>&nbsp;</td></tr>";
  20.                   }
  21.                   $i++;              
  22.          }
  23. ?>
  24.  
  25. </table>
__________________
Si todo fuera tan sencillo como un symfony cc la vida seria más fácil.
http://phpnico.wordpress.com