Re: NEWBIE - Needs Assistance with Joins
| From: | Jason Wong | Date: | Mon, 17 Sep 2001 20:09:34 +0000 |
| Subject: | Re: NEWBIE - Needs Assistance with Joins | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-12521@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: Cecily Walker Kidd <babeephat@hotmail.com>
To: <php-db@lists.php.net>
Sent: Monday, September 17, 2001 5:42 AM
Subject: [PHP-DB] NEWBIE - Needs Assistance with Joins
> Hello,
>
> I have two tables, one that contains an item id, album title name, and
> artist ID number. The second table is a list of artists, with an
> auto-increment artist ID.
>
> I want to join the two tables and have them output to a single PHP page.
> I was following along with the tutorial at
> http://www.webmasterbase.com/article/228/, and tried to modify
> it for my
> own needs. When I do this, I get a parse error on the line that starts
> with SELECT. Here's the code:
>
> $Link = mysql_connect ($Host, $User, $Password);
>
> $CDList =mysql_query(
> "SELECT artist_name, album_title ".
> "FROM artists, album_titles WHERE artist_id = aid");
>
>
> What am I doing wrong?
>
> Thanks in advance.
Try:
--------------------------------------------------------
$CDList = mysql_query("SELECT artist_name, album_title
FROM artists, album_titles
WHERE artist_id = 'aid'"
);
--------------------------------------------------------
hth
--
Jason Wong
Gremlins Associates
www.gremlins.com.hk
Tel: +852-2573-5033
Fax: +852-2573-5851