Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/01/2012, 09:17
quiquebg
 
Fecha de Ingreso: junio-2009
Mensajes: 80
Antigüedad: 14 años, 10 meses
Puntos: 2
Pregunta Imprimir consulta sql en php con una tabla

Código PHP:
?>
<table cellpadding="0" cellspacing="0" width="751" height="169">
    



<?
                        $resulttag 
mysql_query('SELECT * FROM tags WHERE id_usuario=\''.$idrow.'\'');
   
                        while (
$tagg mysql_fetch_row($resulttag)){

                            echo 
"<tr>";
                            echo 
"<td valign='middle' height='130' background='colortags/" $tagg[2] . ".png'>" $tagg[3] . "</td>";
                                echo 
"<td>&nbsp;</td>";
                            echo 
"</tr>";
                            echo 
"<tr>";
                            echo
"    <td width='357'>&nbsp;</td>
                                <td width='37'>&nbsp;</td>
                                <td height='39' width='357'>&nbsp;</td>
                            </tr>"
;
    
                                }
?>

</table>
Esta consulta tal y como la ven... daría un resultado así:




Pero necesito otra cosa... Necesito que el resultado sea así:



He intentado con:

Código PHP:
?>
<table cellpadding="0" cellspacing="0" width="751" height="169">
    



<?
                        $resulttag 
mysql_query('SELECT * FROM tags WHERE id_usuario=\''.$idrow.'\'');
   
                        while (
$tagg mysql_fetch_row($resulttag)){

                            echo 
"<tr>";
                            echo 
"<td valign='middle' height='130' background='colortags/" $tagg[2] . ".png'>" $tagg[3] . "</td>";
                                echo 
"<td>&nbsp;</td>";
                            echo 
"<td valign='middle' height='130' background='colortags/" $tagg[2] . ".png'>" $tagg[3] . "</td>";

                            echo 
"</tr>";
                            echo 
"<tr>";
                            echo
"    <td width='357'>&nbsp;</td>
                                <td width='37'>&nbsp;</td>
                                <td height='39' width='357'>&nbsp;</td>
                            </tr>"
;
    
                                }
?>

</table>

Pero el resultado es:


Alguien sabe como podría hacer lo que necesito? Estoy atascado en este punto y no se continuar :(

Última edición por quiquebg; 22/01/2012 a las 12:48