How would I construct a query with the following base function
$query = mysql_query("SELECT * FROM friend_requests WHERE confirmed=1 AND (sender_id='".$user_id."' OR recipient_id='".$user_id."')");
Where $user_id is the current ID held by the session.
Make sure to call
session_start()to initiate session handling on the page. And make sure to usemysql_real_escape_string()to protect against SQL injection. Your question is a little unclear in terms of what exactly you want from the session. If your$user_idvariable is a value that is stored in the session, you can retrieve it from the$_SESSIONsuperglobal. If$user_idis the actual session id, you can retrieve it using thesession_id()function.