You are creating a new unordered list ul
for every $memberinfo
, so the display:inline
is working, but the ul's remain like block elements.
Create the ul tag before the foreach and close it after it, so your list items will be displayed like you want:
echo "<ul>";
foreach ($memberinfo as $info) {
echo "<li><a href='profile.php?user_id=" . $info['user_id'] . "'><img class='group_member_img' src='uploads/" . $info['avatar'] . "'/><br>" . $info['surname'] . " " . $info['name'] . "</a></li>";
}
echo "</ul>";
By the way, the break line br
tag is unnecessary because you want to put every li one beside the other.