select order_id
from ec_orders
where user_session_id=:user_session_id
and order_state='in_basket'
select count(*)
from ec_items
where order_id=:order_id
select user_id
from ec_orders
where order_id=:order_id
select shipping_address
from ec_orders
where order_id=:order_id
select shipping_method
from ec_orders
where order_id=:order_id
select user_id
from ec_creditcards
where creditcard_id=:creditcard_id
update ec_orders
set creditcard_id=:creditcard_id
where order_id=:order_id
insert into ec_creditcards
(creditcard_id, user_id, creditcard_number, creditcard_last_four, creditcard_type, creditcard_expire, billing_address)
values
(:creditcard_id, :user_id, :creditcard_number, :cc_no , :creditcard_type, :expiry, :billing_address_id)
update ec_orders
set creditcard_id=:creditcard_id
where order_id=:order_id
update ec_orders
set creditcard_id=null
where order_id=:order_id