I am in set cart id parti am here. inside cartstored cart_id was : 46393 i am here. inside login status 0 SELECT IF(EXISTS(SELECT * FROM `cart` WHERE user_id=1 and tmp_id='{2D85B629-E3E3-92E3-5D97-77CDDFD92AC2}'),1,0) as result; This is existing guid : {2D85B629-E3E3-92E3-5D97-77CDDFD92AC2} This is existing : 46393 This is new guid is : {2D85B629-E3E3-92E3-5D97-77CDDFD92AC2} The extracted cart_id is :46393 in sessionCurrent cart_id is : 46393