I have a SQL query that needs to reference three different tables. I'm 
creating an online buddy list of members who are online. I have all of this 
functioning but am trying to also reference another table where the user is 
being blocked, in which case I do not what the user's name to be shown in 
the user's buddy list. I'm using the code below:

//SET $colname TO USER'S ID SESSION
$colname = $HTTP_SESSION_VARS['svUserID'];

//SELECT THE TABLES FROM DATABASE
SELECT distinct useronline.uname, penpals_fav.fav_user_id, penpals_fav.ID
FROM useronline, penpals_fav, penpals_privmsgs_block

// HERE I CHECK IF THE USER'S NAME IS IN THE FAVORITIES USER TABLE
// AND THE ONLINE USER TABLE ALL OF WHICH WORKS FINE
WHERE penpals_fav.fav_user_name = useronline.uname AND penpals_fav.user_id = 
$colname AND penpals_privmsgs_block.user_id = $colname 

It gets tricky here when I try to select from another table because this 
table will not always have the user's name in it, only if the user is 
blocked by another user will there be a record, in which case we do not want 
the user's name to be displayed. I was thinking this, but then realized that 
this would only create a list of those who are being blocked which not what 
I'm trying to do.

AND penpals_privmsgs_block.blocked_id != colname




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to