Ciao a tutti, ho un problema di questo genere:
Ho un DB con varie tabelle; (alunni, insegnanti, ore, materie...ecc.)
Vorrei stampare a video, richiamando i dati tramite SELECT i dati che mi servono. vorrei anche costruire una tabella HTML direttamente da PHP.
************************************************** ***
$result = mysql_query ("(SELECT id FROM horas WHERE id='1' OR id='2' OR id='3' OR id='4') UNION (SELECT clases FROM grupos WHERE id='16' OR id='15') UNION (SELECT materias FROM materias WHERE id='15' OR id='3' )") ;
# 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($tabla1)
while($renglon = mysql_fetch_row($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>";
************************************************** ***********
La tabella che ottengo é:
GRUPO..........MATERIAS
SEPTIMO A
SEXTO A
CONTABILIDAD
MATEMATICAS
**********************************************
vorrei che fosse cosí:
GRUPO..........MATERIAS
SEPTIMO A....CONTABILIDAD
SEXTO A........MATEMATICAS
*************************************************
qualcuno ha una idea?
Grazie in anticipo