Hey,
I wrote a script to seperate the results from a sql query into three columns… This is what I wrote…
[php] $listArtists = mysql_query(“SELECT name2,id FROM er_artists ORDER BY name2 ASC”);
$listArtistsNum = mysql_query(“SELECT id FROM er_artists”);
//Number of Artists
$artistNum = mysql_num_rows($listArtistsNum);
$artistNum2 = ($artistNum / 3);
$artistNum3 = number_format($artistNum2, 0);
// There is more code in here but I took it out for this post because it doesn’t really apply to the question.
$count = 0;
while($row = mysql_fetch_array($listArtists)) {
$count ++;
$getAlbumNum = mysql_query(“SELECT id FROM er_reviews WHERE artistid=’{$row[‘id’]}’”);
$albumNum = mysql_num_rows($getAlbumNum);
echo “<a href=’$PHP_SELF?c=ad&id={$row[‘id’]}’>{$row[‘name2’]} ($albumNum)
”;
if($count % $artistNum3 == 0) {
echo “
}
}[/php]
It normally works, but every once in a while it makes four columns, with the last result in the fourth column. I don’t want that fourth column problem to ever occur.
Thanks,
Nick Giancola