I am in set cart id parti am here. inside cartstored cart_id was : 46406 i am here. inside login status 0 SELECT IF(EXISTS(SELECT * FROM `cart` WHERE user_id=1 and tmp_id='{299728CA-33CF-675A-9717-9A50A7389CBD}'),1,0) as result; This is existing guid : {299728CA-33CF-675A-9717-9A50A7389CBD} This is existing : 46406 This is new guid is : {299728CA-33CF-675A-9717-9A50A7389CBD} The extracted cart_id is :46406 in sessionCurrent cart_id is : 46406