Way newbie here - I can connect to the mySQL db I have and output by category and any active names, but can I split that between 4 table columns without having the column split unevenly away from category? I mean so the if there are 4 columns evenly divided, there isn't an advertiser name in column two split from the category name. Kind of like a keep with next paragraph option in InDesign or some other print pagination program.
Here's my code to date
If anything isn't clear, I'll be happy to try to explain. It's a bit fuzzy for me at this point.
Thanks,
Donna
Here's my code to date
Code:
<?php
$query = "select * from category";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)) {
$categoryid = $row['id'];
$categoryname = $row['category'];
$query2 = "select * from advertisers where category_id='$categoryid' and active=1";
$result2 = mysql_query($query2);
if(mysql_num_rows($result2) > 0 ) {
echo "<h1>".$categoryname."</h1>";
while($row2 = mysql_fetch_array($result2)) {
$advertisername = $row2['name'];
echo "Advertiser is ".$advertisername. "<br />";
}
} else {
echo "No advertisers found for this category.";
}
}
?>
If anything isn't clear, I'll be happy to try to explain. It's a bit fuzzy for me at this point.
Thanks,
Donna