Displaying results from JOIN

From: Date: Thu, 13 Jun 2002 23:07:50 +0000
Subject: Displaying results from JOIN
Groups: php.db 
Request: Send a blank email to php-db+get-19795@lists.php.net to get a copy of this message
Hello, With some help from the mysql list, I've been able to get this query working from the command line SELECT * FROM outings as o INNER JOIN pics AS p1 ON o.pic1_id=p1.pic_id INNER JOIN pics AS p2 ON o.pic2_id=p2.pic_id INNER JOIN pics AS p3 ON o.pic3_id=p3.pic_id INNER JOIN pics AS p4 ON o.pic4_id=p4.pic_id; But when I plug it in to my script ?php $result = mysql_query("SELECT * FROM outings as o INNER JOIN pics AS p1 ON o.pic1_id=p1.pic_id INNER JOIN pics AS p2 ON o.pic2_id=p2.pic_id INNER JOIN pics AS p3 ON o.pic3_id=p3.pic_id INNER JOIN pics AS p4 ON o.pic4_id=p4.pic_id",$db) or die(mysql_error()); if ($myrow = mysql_fetch_array($result)) { do { print <td><img src=$myrow[path]></td>"; } while ($myrow = mysql_fetch_array($result)); } ?> It will display only one of the paths not all four. I think I have to somehow alias in the SELECT part of the query, but I haven't been able to figure out how. Thanks in advance for the help, Mike --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.330 / Virus Database: 184 - Release Date: 2/28/02

« previous php.db (#19795) next »