currently I'm stuck with how I should identify/differentiate a particular account from many accounts that exists in my database. Let's say I am in home page and I click an account and I want the information to be displayed of that particular account that I viewed, but I couldn't display it as I don't know how to identify that particular account that I try to view.
Here's my php code to display all the accounts.
$username = $_SESSION['username'];
$sql1 = "SELECT username, address, country, zipcode, photo, bio FROM user WHERE NOT username = '$username'";
$result = $conn->query($sql1);
if($result->num_rows > 0)
{
while($row = $result->fetch_assoc())
{
echo "<div id = 'account'>";
echo "<span id = 'image'><a id = 'accounts' href = 'accounts.php'><img src = '".$row['photo']."' alt = 'profile photo' width = '100px' height = '100px' style = 'margin-right:40px; margin-top: 5px;'></span>";
echo "<div id = 'username'><big><b style='text-transform:lowercase;'>".$row['username']."</big></a></b><br><small><i><q>".$row['bio']."</q></i></small><br>Lives in <b style='text-transform: capitalize;'>".$row['address']."</b><br>From <b>".$row['country']."</b></div><button id = 'addFriend' type = 'button' onclick = 'addFriends()'>Add friend</button>";
echo "</div>";
}
}
From the above code I can easily identify the user(person who logged in) account by storing his/her username in session from the input text while signing up. But now as theres no textfield or anything from where I can get the username to store in session, I am stuck on how to identify a user. And to retrieve it from database too, I think I pretty much need to identify the user first. Hope I am clear. Thank You in advance.