Okay... I'm missing something obvious.

I've got a PHP query, and based on the results of a query, I need to do
another query for the image name.  This would be very easy in ColdFusion
and so I'm wondering how to do it in PHP.

My code:

<?php
$dbh=mysql_connect ("localhost", "database", "password") or die ('I
cannot connect to the database because: ' . mysql_error());
mysql_select_db ("my_database"); 

// select the table
$result = mysql_query("select * from Rentals, pics WHERE featured = 1
AND ORDER BY RAND() LIMIT 1");

// format results by row
while ($row = mysql_fetch_array($result)) {
$id = $row["ID"];
$pic = mysql_query("select img_name from pics WHERE rntID = 31");
echo  "$pic <br>";
echo  "<a
href=http://www.domain.com/reg/userlisting.php?fulllisting=$id><img
src=../images/$pic alt=Feature width=156 height=117 border=0
class=imgborder /></a>";
echo  "<br><br><a
href=http://www.domaint.com/reg/userlisting.php?fulllisting=$id
class=purple_bg>click here to view this listing</a>";
}
?>

--
Jillian 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208024
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to