Page 1 of 1

images for a particular category

Posted: Mon Dec 01, 2008 4:50 am
by scenic
hello...
plz help me...that how can i display images only related to specific category after click on "more" link....
like...i have 9 categories each category have some images....
for example...i have category "A" & "B".... Both categories have some images...if i click on more button...then images should be display only related to that "A" category...
plz see the code below....

Code: Select all

 
<?php
include('dbconnect.php');
//$category=$_GET['cat'];
$query="SELECT C.category_name, P.Item_image, P.Item_category FROM category_table AS C
        INNER JOIN item_table AS P ON c.category_name = p.Item_category
        WHERE p.Item_image = ( 
                            SELECT p2.Item_image FROM item_table p2
                                WHERE c.category_name = p2.Item_category LIMIT 1 )" ;
 
$result=mysql_query($query);
$num1=mysql_num_rows($result);
$j=$num1;
?>
<body>
<marquee direction="up" onmouseover="this.stop()" onmouseout="this.start()">
<?php 
while ( $row = mysql_fetch_array($result))
    {    
?>  
<table>
<tr>
<td valign="top">
    <p align="justify" ><?php echo $row[0]; ?></p>
</td>
    <?php 
        echo "<br>";
    ?>
    <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
    <td valign="baseline">
        <img src="<?php echo $row[1];?>" width="100px" height="100px" /></td>
    <td>&nbsp;</td>
    <td valign="bottom"><a href="photo2.php">More</a></td>
</tr>
</table>
<?php
}
?>
 
</marquee>
 

Re: images for a particular category

Posted: Thu Dec 04, 2008 3:38 am
by scenic
query solved...