php/mysql how to display a image under a category?

  • Thread starter Thread starter Rach
  • Start date Start date
R

Rach

Guest
Hey Everyone,

What i am trying to do is display a particular image under a particular
category for example

action
action.jpg

arcade
arcade.jpg

The problem i am having is, right now all the pictures appear under each category's like so

action
action.jpg, arcade,jpg

arcade
action.jpg, arcade.jpg

my question is how could i make one image appear for one category?

Right now this is what i currently have. I am using the categories table
to get my category's and the categorypics to get the pictures. They both have in common the name field.

<?php
/*<div class='menuhead".$boxtype."'> controls the category like for example action,arcade*/
echo "

<div class='menuhead".$boxtype."'>

<div class='menutext'>";

$result = mysql_query("SELECT * FROM
categorypics,categories where categorypics.name=categories.name;");
while($row = mysql_fetch_array($result))
{
?>
/*This displays the image"*/
<img src="<?php echo $row['products_image'];?>"><?php

}?>

if anyone could provide a link or an example of what i am trying to do i would appreciate it.

Thank you,
Rach
 
Back
Top