How do i exclude the current logged in user from a PHP\MySqlscript
Posted on 2013-01-18
I have an Andriod application that logs in and querys Mysql PHP script. The script returns a list of books within a date then returns the list into a list view. All this works absolutely fine.
Now i want to bring the same list back but do not include the books for user thats logged in.
At the moment it returns all the books including the user im logging at, could someone suggets away of not to include the current logged in user?
Heres the current PHP script, note i have added the <>1 (this is the userId im logging as) just as a quick work around, abviously this is not a good way though:
$result = mysql_query("SELECT users.uid, users.name, users.book
WHERE EXISTS (SELECT 0 FROM available A1, available A2
WHERE A1.uid =1 AND A2.uid = users.uid
AND A1.AvailableDates = A2.AvailableDates
AND users.uid <>1)") or die(mysql_error());
I would imagine i would need to get the current users id and exclude that from the query (somehow)?