Ive got a while loop that searches through a database finding certain things. Now ive gotten it to actually find the thing its looking for, however it keeps looking and lists the same item 6 times before stopping.
How do i get it to stop after its found it the first time, so that it only lists each item once?
The code is as follows:
//get information on the specific category we want
$query = "SELECT * FROM products WHERE product_cat='$prodcat'";
$results = mysql_query($query)
or die(mysql_error());
//if(mysql_num_rows($results)>0){//there are results returned
while ($row = mysql_fetch_array($results)) {
extract($row);
echo "<p>$product_title";
echo "<br> $product_price";
}
}