Fw: [PHP] join in query no data printed
| From: | Montse | Date: | Tue, 22 Oct 2002 20:50:03 +0000 |
| Subject: | Fw: [PHP] join in query no data printed | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-120981@lists.php.net to get a copy of this message | ||
john you were right, $id_curso had no value, that was the reason
a little rest could do me no harm
thanks a lot
ani lopez
----- Original Message -----
From: "1LT John W. Holmes" <holmes072000@charter.net>
To: "Montse" <montse@lamundial.net>; "PHP list"
<php-general@lists.php.net>
Sent: Tuesday, October 22, 2002 10:40 PM
Subject: Re: [PHP] join in query no data printed
> 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
> >
>
>
>