Hey everyone…I’m really confused about this one. I have a while loop and it should be displaying thousands of results, but it is only displaying 1. I once made the mistake of putting my echo statements outside of the while loop which caused the same problem, but I learned from that. Here’s the php:
[code=php]
<?php
$category = ereg_replace(“[^A-Za-z0-9]”, “”, $_GET[‘category’]);
$query = “SELECT * FROM members WHERE category=’$category’ ORDER BY accounttype DESC”;
$sql = mysql_query($query);
$count = mysql_num_rows($sql);
if ($count < 1) {
echo “Nothing found for this category.”;
exit();
}
while($row = mysql_fetch_array($sql)){
echo “<div style=’background-image:url(images/account” . $row[“accounttype”] . “.jpg);height:212px;overflow:hidden;’>”;
echo “<h2 class=’listingH2′ style=’margin-left: 10px; text-shadow: none;’><a href=’member_profile.php?id=” . $row[“id”] . “‘>” . $row[“business_name”] . “</a></h2>”;
echo “<p>Rating: <img src=’images/” . $row[“rating”] . “of5.png’></p>”;
echo “<p>Category: ” . $row[“category”] . “</p>”;
echo “<div class=’resultAddress’>”;
echo “<p>” . $row[“address”] . “</p>”;
echo “<p>” . $row[“city”] . “,” . $row[“state”] . “ ” . $row[“zip”] . “</p>”;
echo “<p>” . $row[“phone”] . “</p>”;
echo “</div>”;
echo “<img style=’position:relative;bottom:20px;’ src=’images/listing-div.jpg’ width=’735′ />”;
echo “<div style=’clear:both;’></div>”;
echo “<div class=’resultsAccountType’>”;
echo “<img src=’images/” . $row[“accounttype”] . “.png’>”;
echo “</div>”;
}
?>
What am I messing up on here? Any help would be much appreciated!