I've tried to add in some code from jpadie to the output I have that did work, but I get no output at all now. Can someone point out what I've screwed up, please?
Here 'tis
Thanks,
Donna
Here 'tis
Code:
<?php require_once("includes/connection.php"); ?>
<?php
$numColumns = 4;
//CREATE THE SQL QUERY TO PULL ALL VISIBLE LISTINGS
$sql = "select * from advertisers a left join category c USING(category_id) ";
$sql .= "WHERE a.visible = 1 order by c.category_name asc, a.advertiser_name asc ";
$result = mysql_query($sql);
$count = mysql_num_rows($result);
$currentCategory = "";
//start output
if ($count > 0){
echo "\r\n";
} else {
die ('no records found');
}
while($row = mysql_fetch_array($result)){
//PRINT OUT THE CATEGORY NAME EVERY TIME IT CHANGES
//start the inner loop
for ($i=0; $i<$numColumns; $i++){
if ($currentCategory == "" || $currentCategory != $row['category_id']){
echo "<div class='categoryName' style='font-weight:bold;margin-top:8px;'>";
echo "<a href='category.php?cid=".$row['category_id']."'>" .stripslashes($row['category_name'])."</a></div>";
$currentCategory = $row['category_id'];
}
else {
//prevent broken end columns
echo "\r\n";
}
//PRINT OUT THE ADVERTISER
echo "<div class='advertiserName'>";
echo "<a href='category.php?cid=".$row['category_id']."#advertiser_".$row['advertiser_id']."'>";
echo stripslashes($row['advertiser_name']);
echo "</a></div>";
}
?>
Thanks,
Donna