You are here: phpcoin and mysql query « PHP Programming Language « IT news, forums, messages
phpcoin and mysql query

Posted by Ben Allen on 10/12/58 11:25

Hi,
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:

phpcoin_clients:
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

phpcoin_clients_contacts:
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='email@domain.com')
OR (contacts_email='email@domain.com')
AND contacts_cl_id=cl_id

This only returns the client id (cl_id) when the contacts_email is set
to email@domain.com.

If the query is just:
SELECT cl_id from phpcoin_clients
WHERE (cl_email='email@domain.com')

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

Thanks,
Ben

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация