Jump to content

Recommended Posts

Hi Guys, Could someone check what's going wrong?
I need the output as an error if the values in both tables are incorrect.

If postcode in table "TABLE_INSELPLZ" is not the same as postcode in table "TABLE_ADDRESS_BOOK" or city name in table "TABLE_INSELPLZ" is not the same as city name in table "TABLE_ADDRESS_BOOK"

With this query I get the error only if ZIP code in table "TABLE_INSELPLZ" is the same as ZIP code in table "TABLE_ADDRESS_BOOK" otherwise not. Thank you for your help

$addresses_query = tep_db_query("select ip.insel_plz, ip.insel_name, ip.insel_country, ip.insel_status, 
                                        ab.address_book_id, ab.customers_id, ab.entry_firstname as firstname, ab.entry_lastname as lastname, ab.entry_company as company, ab.entry_street_address as street_address, ab.entry_suburb as suburb, ab.entry_city as city, ab.entry_postcode as postcode, ab.entry_state as state, ab.entry_zone_id as zone_id, ab.entry_country_id as country_id 
                                        from " . TABLE_INSELPLZ . " ip left join " . TABLE_ADDRESS_BOOK . " ab 
                                        on ip.insel_plz != ab.entry_postcode and ip.insel_country != ab.entry_country_id
                                        where ab.customers_id = '" . (int)$customer_id . "' and ip.insel_name = ab.entry_city or ip.insel_plz = ab.entry_postcode or ip.insel_country = ab.entry_country_id order by firstname, lastname");
      while ($addresses = tep_db_fetch_array($addresses_query)) {


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this