Ver Mensaje Individual
  #5 (permalink)  
Antiguo 18/04/2011, 16:55
osafado
 
Fecha de Ingreso: septiembre-2010
Mensajes: 92
Antigüedad: 13 años, 6 meses
Puntos: 1
Respuesta: Como construir una tabla html de varias tablas sql

Gracias a todos por las respuestas...

Esto es mi codigo:


<?php include ("../conexion.php");

//************************************************** ***********************

$result = mysql_query ("(SELECT clases FROM grupos WHERE id='16' OR id='15') UNION (SELECT materias FROM materias WHERE id='15' OR id='3' ) UNION (SELECT id FROM horas WHERE id='4' OR id='2')") ;


# empezando una tabla html
echo "<HTML><TABLE Border=0 CellPadding=1 align=center ><TR>";

# construyendo los encabezados de la tabla
echo " <th bgcolor=silver><font size=1 >GRUPO</font></th><th bgcolor=silver><font size=1 >MATERIAS</font></th><th bgcolor=silver><font size=1 >HORAS</font></th></TR>";

// ciclo de lectura del rowset
while($renglon = mysql_fetch_array($result))

{
// desplegando en celda de tabla html
echo "<tr>";
echo "<td><font size=1 >".$renglon[0]."</font></td";
echo "<td><font size=1 >".$renglon[1]."</font></td>";
echo "<td><font size=1 >".$renglon[2]."</font></td>";
echo "<td><font size=1 >".$renglon[3]."</font></td>";
echo "</tr>";
};
// cerrando tabla html
echo "</table>";

header('Location: /www/evaluacion/metas.php');
?>

************************************************** *********
Todo funciona, solo que los datos me los pones en la primera columna.


La tabla che obtengo es:

GRUPO..........MATERIAS
SEPTIMO A
SEXTO A
CONTABILIDAD
MATEMATICAS

**********************************************

queria fuera así:


GRUPO..........MATERIAS
SEPTIMO A....CONTABILIDAD
SEXTO A........ MATEMÁTICAS

***************************

Espero que así sea mas claro.

Gracias