Re: Join - problem
| From: | 1LT John W. Holmes | Date: | Wed, 18 Sep 2002 15:31:43 +0000 |
| Subject: | Re: Join - problem | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-116748@lists.php.net to get a copy of this message | ||
Don't include the ; in your query, for one thing.
---John Holmes...
----- Original Message -----
From: "John Wards" <j.wards@sportnetwork.net>
To: "Henning" <henningolsen36@netscape.net>
Cc: <php-general@lists.php.net>
Sent: Wednesday, September 18, 2002 11:26 AM
Subject: Re: [PHP] Join - problem
> not having the time to look at your code I am not sure but do this to see
if
> its mysql causeing the errors
>
> $result = mysql_query($query) or die(mysql_error());
> ----- Original Message -----
> From: "Henning" <henningolsen36@netscape.net>
> To: <php-general@lists.php.net>
> Sent: Wednesday, September 18, 2002 5:12 PM
> Subject: [PHP] Join - problem
>
>
> > Hello
> > I'm using PHP4 and MySQL on Apache webserver.
> > I have a table valled "liste" with names of some people, and a table
> > called "postnummer" with zip-codes and citynames.
> > My select should join the adress and zip from one table with the
> > cityname from the other table.
> > But my join-line does not work. =:(
> >
> > My code results in this line:
> >
> > Warning: Supplied argument is not a valid MySQL result resource in
> > /var/www/html/find/resultat.php on line 27
> >
> > The code is:
> > mysql_select_db("adresser");
> > $query = ("SELECT fornavn, efternavn, gade, liste.postnummer,
> > postnummer.postbynavn FROM liste
> > left join postnummer on liste.postnummer = postnummer.postnummer
> > WHERE MATCH (fornavn, efternavn) AGAINST ('$search');");
> > $result = mysql_query($query);
> > while(list( $fornavn, $efternavn, $gade, $postnummer, $postbynavn) =
> > mysql_fetch_row($result))
> >
>
print("<TR><TD>$fornavn</TD><TD>$efternavn</TD><TD>$gade</TD><TD>$postnummer
> </TD><TD>$postbynavn</TD></TR>\n");
> >
> >
> > What is going on?
> > The select is ok if I do not join, but then I'm not able to get the
> > field "postbynavn" from the other table.
> >
> > PLEASE HELP!
> >
> > Henning
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>