I am somewhat new to php and am trying to learn how to make more of a community website, which involves adding friends to a profile. My problem is, when displaying all of the friends on a page, I would like a new row after every 3 entries. The code below isn't working and displays all the pictures on a separate row.
I have looked up similar issues to this and unfortunately I still can't figure it out. Any help would be great. Thank you.
The $offset can be ignored as it is only used for page numbers. That part works ha.
$query_page2 = "SELECT * FROM friendslist WHERE user_id='$userid' ORDER by lastname,firstname ASC LIMIT 12 OFFSET ".$offset;
$result_page2 = mysql_query($query_page2) or die ("<br /><br />There's an error in the MySQL-query: ".mysql_error());
while ($row_page2 = mysql_fetch_array($result_page2))
{
$ffriendid = $row_page2["friend_id"];
$query_page3 = "SELECT * FROM members WHERE userid='$ffriendid' ORDER by userid ASC";
$result_page3 = mysql_query($query_page3) or die ("<br /><br />There's an error in the MySQL-query: ".mysql_error());
$count = 0;
while ($row_page3 = mysql_fetch_array($result_page3))
{
$userid2 = $row_page3["userid"];
$callsign2 = $row_page3["callsign"];
$pic = $row_page3["image"];
if ($count%4 == 0)
{
echo "</tr><tr><td><a href='enlarge.php?view&id=$userid2'><img src='$pic' style='border-color: black' width='125'></a><br>$callsign2</td>";
}
else
{
echo "<td><a href='enlarge.php?view&id=$userid2'><img src='$pic' style='border-color: black' width='125'></a><br>$callsign2</td>";
}
$count++;
}}