Log in

View Full Version : Compare values of 2 columns in tables



RazorMaster
05-04-2008, 10:50 PM
Hi,

I need some help with this peace of script please...

I have two tables of users... ex:

Table1
buyers_id
buyers_BI

Table2
Sellers_id
Sellers_BI

I have 2 tables because I don't want buyers as sellers and sellers as buyers, so I have this XX_BI that is a personal number (identification).
So far I could write php code to verify when a buyer ou seller register, it compares if the BI allready exists in the DB. If exists, it not allow registration.
But if I try to register a buyer with a BI existing in the table 2 but not in the table 1, it allow, and is this I want to prevent...

Can anyone help with this?
How can I compare if buyers_BI already exists in sellers_BI and vice-versa?
How can I search 1 value in 2 tables at the same time and not allow registration because there is 1 BI that someone is trying to add?

Thanks.