join in query no data printed
| From: | Montse | Date: | Tue, 22 Oct 2002 20:29:32 +0000 |
| Subject: | join in query no data printed | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-120978@lists.php.net to get a copy of this message | ||
Hi
this should be simple but I don't know why nothing is echoed
the query is working fine, I've checked it in phpmyadmin
and I get several rows. no error printed.
what I'm doing wrong?
thanks in advance
ani lopez
include("db_conex.inc");
$sql = "SELECT
t1.titulo t1_titulo,
t1.fecha t1_fecha,
t1.nom_alumno t1_nom_alumno,
count(t2.id_tema) t2_cuantas
FROM
foro_temas t1,
foro_opiniones t2
WHERE
t1.id=t2.id_tema
AND
t1.id_curso='$id_curso'
GROUP BY
t2.id_tema";
$result = mysql_query($sql);
while ( $row = mysql_fetch_array($result) ) {
$titulo = $row["t1_titulo"];
$fecha = formatfechahora($row["t1_fecha"]);
$nom_alumno = $row["t1_nom_alumno"];
$cuantas = $row["t2_cuantas"];
echo("$titulo $fecha $nom_alumno $cuantas<br>");
}
include("db_deconex.inc");