Click to See Complete Forum and Search --> : Need help unserializing a session and retrieveing a variable


celshader
02-03-2008, 07:21 PM
I need to unserialize session info from an MYSQL database and then retrieve a variable from it in PHP.

The code I am using to query the database is

$product_price_query = mysql_query("select value from " . TABLE_SESSIONS . " where sesskey = '" . tep_db_input($key) . "' and expiry > '" . time() . "'");
$product_price_fetch = mysql_fetch_array($product_price_query);

The session info is

cart|O:12:"shoppingcart":5:{s:8:"contents";a:1:{s:133:"28{txt_1}{txt_2}1300{txt_3}1700{txt_4}1{txt_5}Sliding{txt_7}Lacquered{txt_6}2.21{txt_8}{txt_9}H1 - Floor Guides{txt_10}{txt_11}1933.1";a:3:{s:3:"qty";i:1;s:17:"attributes_values";a:8:{i:2;s:4:"1300";i:3;s:4:"1700";i:4;s:1:"1";i:5;s:7:"Sliding";i:7;s:9:"Lacquered";i:6;s:4:"2.21";i:9;s:17:"H1 - Floor Guides";i:11;s:6:"1933.1";}s:10:"attributes";a:8:{i:2;i:0;i:3;i:0;i:4;i:0;i:5;i:0;i:7;i:0;i:6;i:0;i:9;i:0;i:11;i:0;}}}s:5:"total";d:0;s:6:"weight";d:0;s:6:"cartID";s:5:"24957";s:12:"content_type";b:0;}language|s:7:"english";languages_id|s:1:"1";currency|s:3:"AUD";navigation|O:17:"navigationhistory":2:{s:4:"path";a:3:{i:0;a:4:{s:4:"page";s:9:"index.php";s:4:"mode";s:6:"NONSSL";s:3:"get";a:0:{}s:4:"post";a:0:{}}i:1;a:4:{s:4:"page";s:16:"product_info.php";s:4:"mode";s:6:"NONSSL";s:3:"get";a:2:{s:11:"products_id";s:2:"28";s:6:"action";s:11:"add_product";}s:4:"post";a:2:{s:2:"id";a:11:{s:5:"txt_1";s:0:"";s:5:"txt_2";s:4:"1300";s:5:"txt_3";s:4:"1700";s:5:"txt_4";s:1:"1";s:5:"txt_5";s:7:"Sliding";s:5:"txt_7";s:9:"Lacquered";s:5:"txt_6";s:4:"2.21";s:5:"txt_8";s:0:"";s:5:"txt_9";s:17:"H1 - Floor Guides";s:6:"txt_10";s:0:"";s:6:"txt_11";s:6:"1933.1";}s:11:"products_id";s:2:"28";}}i:2;a:4:{s:4:"page";s:17:"shopping_cart.php";s:4:"mode";s:6:"NONSSL";s:3:"get";a:0:{}s:4:"post";a:0:{}}}s:8:"snapshot";a:0:{}}

The variable I'm trying to get is called txt_11

I have limited knowledge of sessions so I don't know where to go from here.
Thanks in advance for any help.

I'm using oscommerce if that is any help.