jay83rr Posted October 15, 2013 Share Posted October 15, 2013 Hi I have a session $_SESSION['pdf_quote'] which has a number of variables which i can easily echo/print. But... in the same session i have 2 arrays. I have no idea how to echo/print the contents of what is in the arrays. These are the arrays[product_arr] => Arrayand[extra_arr] => Array Link to comment https://forums.phpfreaks.com/topic/282981-echoprint-info-from-array-from-session-variable/ Share on other sites More sharing options...
Ch0cu3r Posted October 15, 2013 Share Posted October 15, 2013 Do you want to see what is stored in these arrays? You can use print_r for that printf('<pre>%s</pre>', print_r($_SESSION['pdf_quote'], true)); Link to comment https://forums.phpfreaks.com/topic/282981-echoprint-info-from-array-from-session-variable/#findComment-1453968 Share on other sites More sharing options...
jay83rr Posted October 15, 2013 Author Share Posted October 15, 2013 when i run that i get the following but it still won't show me the contents of product_arr i think i need to implode to get the array... but thats where i get lost. Array( [id] => 46 [location_id] => 4 [type] => pickup [status] => pending [payment_method] => none [is_paid] => 0 [txn_id] => [processed_on] => [price_subtotal] => 3125.00 [price_delivery] => 0.00 [price_total] => 3125.00 [voucher_code] => [created] => 2013-10-15 21:12:20 [p_dt] => 2013-10-25 08:00:00 [d_address_1] => [d_address_2] => [d_country_id] => [d_state] => [d_city] => [d_zip] => [d_notes] => [d_dt] => [c_name] => test [c_email] => [email protected] [c_phone] => 8298392832 [c_address_1] => eokeoj [c_address_2] => [c_notes] => [c_country] => [c_state] => test [c_city] => [c_zip] => 2000 [cc_type] => [cc_num] => [cc_code] => [cc_exp] => [product_arr] => Array ( [0] => Array ( [extra_arr] => Array ( ) ) )) Link to comment https://forums.phpfreaks.com/topic/282981-echoprint-info-from-array-from-session-variable/#findComment-1453970 Share on other sites More sharing options...
Ch0cu3r Posted October 15, 2013 Share Posted October 15, 2013 What specific data do you need from that array? What are you trying to do? Link to comment https://forums.phpfreaks.com/topic/282981-echoprint-info-from-array-from-session-variable/#findComment-1453971 Share on other sites More sharing options...
jay83rr Posted October 15, 2013 Author Share Posted October 15, 2013 im using the data to populate a ezpdf class php file. I've got all the info except what products the customer chose in the shopping cart. I'm guessing these are stored in the array that i can't see the contents of. Link to comment https://forums.phpfreaks.com/topic/282981-echoprint-info-from-array-from-session-variable/#findComment-1453973 Share on other sites More sharing options...
Ch0cu3r Posted October 15, 2013 Share Posted October 15, 2013 I'm guessing these are stored in the array that i can't see the contents of. Try looking to see what is stored within the whole of $_SESSION variable printf('<pre>%s</pre>', print_r($_SESSION, true)); If the product info is not in the session then your shopping cart is most likely storing the products information within the database. The $_SESSION['pdf_quote']['id'] varibale could hold the product id, This is used in database query to get the products information. You will want to look at your shopping carts documentation on how it stores and retrieves products in the database. Link to comment https://forums.phpfreaks.com/topic/282981-echoprint-info-from-array-from-session-variable/#findComment-1453979 Share on other sites More sharing options...
jay83rr Posted October 15, 2013 Author Share Posted October 15, 2013 argh i just looked in the mysql database and there under orders are the products for each order!! i've seen them there 100 times and just haven't realised! Thanks a heap! Link to comment https://forums.phpfreaks.com/topic/282981-echoprint-info-from-array-from-session-variable/#findComment-1453981 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.