I'm using a row to return all of the users for a particular project, which isn't a problem. However, how would I order it so that the first result is always the logged in user.
I see two solutions, both of which I've tried with no success:
-
Printing the user's name then using an if statement to only print the rest of the row if they are different from the user's name.
print user's name; if (username !== user's name) { print this name; }
Printing them all in a row but ordering it somehow so that the current user is at the top.
Any ideas?
EDIT
I'm trying it now with the following code:
$query7 = mysql_query("SELECT users_ID FROM projects_users WHERE projects_id = '$id' AND WHERE users_id <>'$q6[0]'") or die(mysql_error());
But I get the error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE users_id <>'1'' at line 1
I've tried != and NOT instead of <> but I can't see what's going wrong!
Never mind, fixed it. For future reference, don't sure WHERE twice ;)
Thanks for your help everyone.