Re: join in query no data printed
| From: | 1LT John W. Holmes | Date: | Tue, 22 Oct 2002 20:40:38 +0000 |
| Subject: | Re: join in query no data printed | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120979@lists.php.net to get a copy of this message | ||
Well, if nothing is being printed, and you're not getting an error about
$result, then you're not returning any rows. Are you sure $id_curso has a
value??
---John Holmes...
----- Original Message -----
From: "Montse" <montse@lamundial.net>
To: "PHP list" <php-general@lists.php.net>
Sent: Tuesday, October 22, 2002 4:29 PM
Subject: [PHP] join in query no data printed
> 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");
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>