UnknownPlayer Posted December 2, 2010 Share Posted December 2, 2010 Need help with this code, if someone can help me.. // current session id $sid = session_id(); // check if the product is already // in cart table for this session $sql = "SELECT pd_id FROM tbl_cart WHERE pd_id = $productId AND ct_session_id = '$sid'"; $result = dbQuery($sql); There is a problem with $sid = session_id();, in my code, that function always get me 0 in my php code.. do i need to set this in some other way.. Anyway, there are no registred users, i just need to set session for current user.. Like this tutorial: http://www.phpwebcommerce.com/shop-add-to-cart.php Link to comment https://forums.phpfreaks.com/topic/220475-need-help-about-shopping-cart-session/ Share on other sites More sharing options...
BlueSkyIS Posted December 2, 2010 Share Posted December 2, 2010 is session_start() somewhere about that code snippet? if not, you'll get no session_id() Link to comment https://forums.phpfreaks.com/topic/220475-need-help-about-shopping-cart-session/#findComment-1142256 Share on other sites More sharing options...
UnknownPlayer Posted December 2, 2010 Author Share Posted December 2, 2010 Thanks Is it wrong if i put this code in every page in my website ? Link to comment https://forums.phpfreaks.com/topic/220475-need-help-about-shopping-cart-session/#findComment-1142282 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.