php/mysql 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 1 picture under 1 category (similar to how a shopping cart works). For example

dogs cats
dogs.jpg cats.jpg

but right now all i can get it to do is

dogs cats
dogs.jpg,cats.jpg dogs.jpg,cats.jpg

so i am wondering how can i display one image per category?like i said right now all i get is all the images displaying per category instead of 1 picture per category. here is what i have

<?php

boxtype displays a blue box where the name of the category goes
<div class='menuhead".$boxtype."'>

category['name'] displays the name of the category
<div class='menuheadtext'>".$category['name']." ".$category['type']."</br></div>
</div>

anything below menutext displays the pictures per category (but in this case it displays all the images for each category)
<div class='menutext'>";


/*the following foreach ($games as $game) { } controls 3 games per section being displayed*/
/*the dispgametd(true); displays the picture for the games*/

/* foreach ($games as $game) {*/

/*$link = get_game_link("id="._sp($game['id']));
*/
$result = mysql_query("SELECT * FROM categorypics order by pd_id");

while($row = mysql_fetch_array($result)) {
echo "<img src=\"$row[products_image]\" alt=\"\" />\n";
products_image displays the image
}
</div>
?>

Thank you,
Rachel
 
Back
Top