This question already has an answer here:
on my database i have a category, how do I display a specific category only to be display on my php page ?
<?
include("conn.php");
$result=mysql_query("select * from products");
while($row=mysql_fetch_array($result)){
if(@$count % 2==0){
?>
<table border="0" cellpadding="2px" width="1000px">
<?php } ?>
<td width="500"><img src="gambar/<?=$row['Gambar']?>" />
<br><b><?=$row['product_name']?></b><br />
<?=$row['description_name']?><br />
Price:<big style="color:green">
RM<?=$row['price']?></big><br /><br />
the code above display all the item in the database.
</div>
Add where
condition in query to filter Your result
select * from products where category='books'
You can do it from your sql query,
mysql_query("select p from products where p.categorie= somecateg");
and set the parameters.
or use a if condition
<? if (?=$row['product_categ'] == "somecateg" ?>
But the first one is clean