Ok, I'm stumped, I'd like for my page to display up to 2 rows of four members, but if there are more than 8 members, I'd like 8 listed and a link to a "view all members" page.
<?php
define('ITEMS_PER_PAGE', 4);
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT * FROM websitefriends WHERE friend1='$siteusername'";
$result = mysql_query($query);
$item = 0;
while($row = mysql_fetch_array($result)){ ?>
<td align="center" valign=top width=20%>
<FONT face="Arial, Helvetica" size=3 color="White">
<a href="profile.php?siteusername=<? echo $row['friend2'] ?>">
<font color=224982><? echo $row['friend2'] ?></a>
<br>
<a href="profile.php?siteusername=<? echo $row['friend2'] ?>">
<img src="<? echo $row['picture'] ?>.jpg" width=100 border=0></a>
</td>
<?
if($item == ITEMS_PER_PAGE - 1){
$item = 0;
echo '</tr><tr>';
} else {
$item++;
}
}
mysql_close();
?>
That lets me display as many rows of four as there are members, but I'd like to stop at two rows(8 members)...any ideas?