Re: help w/Multiple Joins
| From: | Bastian Vogt | Date: | Thu, 21 Nov 2002 08:51:30 +0000 |
| Subject: | Re: help w/Multiple Joins | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-23554@lists.php.net to get a copy of this message | ||
hi,
you have to create aliases for every column you want to fetch results from.
you have to change your query like this:
SELECT i1.img_path AS i1_path, i2.img_path AS i2_path, i3.....
you can leave out the "AS" if you want to..
hth, bastian
> $result = mysql_query("SELECT * FROM photo_album as p INNER JOIN images
> AS i1 ON p.img_1=i1.img_id
> INNER JOIN images AS i2 ON p.img_2=i2.img_id
> INNER JOIN images AS i3 ON p.img_3=i3.img_id
> INNER JOIN images AS i4 ON p.img_4=i4.img_id",$db)or
> die(mysql_error());