Hello
I am trying to write a script whereby I can pull an image out of one database table and display it in relation to its category_id in another table. I am using a my_sql join function that is joining the tables correctly, however it only shows the one same image from the top field of those combined rows on every single page. I need it display the image according to its category_id for that particular page. I am thinking I need to set variables to represent those specific rows but I'm not sure how to do that.
Here is my code
{
$result = mysql_query("SELECT
placing_item_bid.category_id
, category_master.icon_1
FROM
school_auction.category_master
, school_auction.placing_item_bid
WHERE
placing_item_bid.category_id=category_master.category_id and
category_master.icon_1=category_master.icon_1");
$row = mysql_fetch_array( $result );
$img=$row['icon_1'];
list($width, $height, $type, $attr) = getimagesize("images/$img");
$h=$height;
$w=$width;
if($h>200)
{
$nh=200;
$nw=($w/$h)$nh;
$h=$nh;
$w=$nw;
}
if($w>160)
{
$nw=160;
$nh=($h/$w)$nw;
$h=$nh;
$w=$nw;
}
?>
<img name="runimg" src="images/<? echo $row['icon_1'];?>"
border=1 width=<?= $w; ?> height=<?=$h?> >
Here is an example of the page I am using it on. It should be pulling in an image of a ford icon but it's not
http://www.schoolauction.com/detail.php?item_id=739
Any help or advice would be great.