phpcoin and mysql query

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

This maybe off-topic as it is mainly SQL, but I thought I would ask here  
as I have had many helpful replies from here in the past and also the  
query is being run from a php script (although examples here are from  
where I was testing it in phpMyAdmin)
I'm using a piece of software called 'phpcoin' along with the popular  
'IPN' mod. I am having some problem with it and have got it down to an  
mySQL function functioning incorrectly.

This is the structure of the tables involved:

Field          Type           Null      Default
cl_id          int(11)     No      0
cl_join_ts      varchar(10)     Yes      NULL
cl_status      varchar(20)     No      pending
cl_company      varchar(50)     No      
cl_name_first      varchar(20)     No      
cl_name_last      varchar(20)     No      
cl_addr_01      varchar(50)     No      
cl_addr_02      varchar(50)     No      
cl_city      varchar(50)     No      
cl_state_prov      varchar(50)     No      
cl_country      varchar(50)     No      
cl_zip_code      varchar(12)     No      
cl_phone      varchar(20)     No      
cl_email      varchar(50)     No      
cl_user_name      varchar(20)     No      
cl_user_pword      varchar(50)     No      
cl_notes      text         No      
cl_groups      int(11)     No      0

Field              Type           Null      Default
contacts_id          int(11)     No      
contacts_cl_id      int(11)     No      0
contacts_name_first      varchar(20)     No      
contacts_name_last      varchar(20)     No      
contacts_email      varchar(50)     No

The sql query is as follows:

SELECT cl_id from phpcoin_clients, phpcoin_clients_contacts
WHERE (cl_email='')
OR (contacts_email='')
AND contacts_cl_id=cl_id

This only returns the client id (cl_id) when the contacts_email is set  

If the query is just:
SELECT cl_id from phpcoin_clients
WHERE (cl_email='')

Then the result is as expected, anyone have any ideas as to why this is?


Site Timeline