I’m currently having an issue with the fact that when I run my query
$user_name=$_SESSION['user_name']; //stores person that is logged in
$query = "SELECT * FROM user WHERE user_name != '$user_name'";
$data = mysql_query($query);
$info = mysql_fetch_array($data);
while($info = mysql_fetch_array($data)) {
Print "<tr>";
Print "<th>Username:</th> <td>".$info['user_name'] . "</td></tr>";
}
Now the problem lies with the fact that it prints every item except the one of the user that’s logged in but also the record right below the current logged in user.
so when my database looks like this
|----------------------------------|
| ID | user_name | user_email |
|----------------------------------|
1 User1 Email1
2 User2 Email2
3 User3 Email3
4 User4 Email4
5 User5 Email5
And I’m logged in as user1 then it only shows user 3-5
When I’m logged in as user3, it only shows 1,2 & 5
So it always skips the next record
When I run the query with SQL it works, but as soon as I do it with this code it doesn’t print everything.