Long title XD
I have a table containing information about the users (username etc…). How can I extract the content of a field, based on the user that is logged in, and use it in a SQL query?
Example that I’m inventing right now: the user A logs in and I want to show him a list of all the other users that are older than him (of course there is an “age” field in every table entry).
How can I do this?
Thanks for your help 
Anyway, while I was reading, the solution came up to my mind 
http://dev.mysql.com/doc/refman/5.1/en/select.html
Or you could google for ‘mysql tutorials’, or ‘php mysql tutorials’ if your question is how to do such extractions with php. 
My question would be more like “Can I have a PHP command inside a SQL query?” 
(Grazie
)
You can construct and run a query using PHP. Take a look at the manuel and see what method you want to use.
For example:
There are loads of examples there too.