So i went for 4 DIVs using a UL. Here is my code, i had to use task manager to close IE as it was stuck in a loop XD
Code: Select all
<?php $result = mysql_query("SELECT * FROM games");
$gamecount = mysql_num_rows($result);
$result2 = mysql_query("SELECT * FROM games ORDER BY title ASC");
$row = mysql_fetch_array($result2);
$gamesperrow = $gamecount / 5;
$count1 = 0;
$count2 = 0;
$count3 = 0;
$count4 = 0;
?>
<div style="float:left; width: 146px; font-size: 12px;">
<ul>
<?php while($count1 <= $gamesperrow) {
echo "<li><a href=\"playgame.php?game=" . $row['title'] . "\">" . $row['title'] . "</a></li>";
$count1++;
} ?>
</ul>
</div>
<div style="float:left; width: 146px; font-size: 12px;">
<ul>
<?php while($count2 <= $gamesperrow) {
echo "<li><a href=\"playgame.php?game=" . $row['title'] . "\">" . $row['title'] . "</a></li>";
$count2++;
} ?>
</ul>
</div>
<div style="float:right; width: 146px; font-size: 12px;">
<ul>
<?php while($count3 <= $gamesperrow) {
echo "<li><a href=\"playgame.php?game=" . $row['title'] . "\">" . $row['title'] . "</a></li>";
$count3++;
} ?>
</ul>
</div>
<div style="float:right; width: 146px; font-size: 12px;">
<ul>
<?php while($count4<= $gamesperrow) {
echo "<li><a href=\"playgame.php?game=" . $row['title'] . "\">" . $row['title'] . "</a></li>";
$count4++;
} ?>
</ul>
</div>EDIT: Just realised i was incrementing the count1, corrected, now it displays the first game in my database over and over, any help? Also, the way im doing it to decide games per 'row' there are 14 games in my DB atm, and its displaying 3 per 'row' so i have 12 games displaying(Well i would, if the links wern't all the same... So should i like round the number? Just looking at php.net at the rounding thing, how would i round the number upwards, because i dont want it to ever round down...?
Oscardog