select order_id
from ec_orders
where user_session_id=:user_session_id
and order_state='in_basket'
update ec_addresses
set attn=:attn, line1=:line1, line2=:line2, city=:city, usps_abbrev=:usps_abbrev, zip_code=:zip_code, phone=:phone, phone_time=:phone_time
where address_id=:address_id
insert into ec_addresses
(address_id, user_id, address_type, attn, line1, line2, city, usps_abbrev, zip_code, country_code, phone, phone_time)
values
(:address_id, :user_id, :address_type, :attn, :line1,:line2,:city,:usps_abbrev,:zip_code,'US',:phone,:phone_time)
update ec_orders
set shipping_address=:address_id
where order_id=:order_id