I am trying to create a social network. In the profile details I want to display at least 10 friends of that profile user. I used:
$connect = mysqli_connect("...","...","...","dbname"); //NOT REALLY IMPORTANT
$find = "SELECT * FROM friendslist WHERE user1 = '$myusername'";
$exec = mysqli_query($connect,$find);
while($row=mysqli_fetch_assoc($exec)) {
$friendusername = $row['user2'];
$con2 = "SELECT * FROM users WHERE username = '$friendusername' ";
$exec2 = mysqli_query($con,$con2);
$row2 = myslqi_fetch_assoc($exec2);
echo $row2['firstname']."<br/>";
My tables:
FOR friends:
id, user1, user2
FOR users
id, username, firstname
It will display all my friends like if I have 20 friends, it will display all 20 of them. How can I limit it to display only 10?