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




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to