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 Quote 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 (edited) 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)); Edited October 15, 2013 by Ch0cu3r Quote 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 (edited) 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] => test@test.com [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 ( ) ) )) Edited October 15, 2013 by jay83rr Quote 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? Quote 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. Quote 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...
Solution Ch0cu3r Posted October 15, 2013 Solution 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. Quote 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! Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.