tbone05420 Posted May 11, 2008 Share Posted May 11, 2008 Hi All, I am working with an array from a DB which is serialized. I am able to unserialize it and load the array into a variable. Now once I have it there, I am having trouble reading a certain value from the array. I would also like to place another entry into the array, serialize it and place it back into the DB. Here are the values in the array... Array ( [1] => Array ( [shipping] => Custom shipping method [rates] => Array ( [0] => 25.45 ) [tracking_number] => 123456789[carrier] => FDX ) ) A) For example, how would I load the tracking number(123456789) into a variable $trackit B) How would I insert a different tracking number back in. say 987654321, so I can in turn reserialize the array and update the DB. I am not asking about the serializing or writing to the DB, just the array stuff. Thanks, TBone Link to comment https://forums.phpfreaks.com/topic/105089-solved-help-with-array/ Share on other sites More sharing options...
mlin Posted May 11, 2008 Share Posted May 11, 2008 well, if your variable name is var $trackit = $var[1]['tracking_number']; //then you could do what ever you want with trackit, when you want to update your array assuming you've edited trackit $var[1]['tracking_number'] = $trackit; is that what you mean? Link to comment https://forums.phpfreaks.com/topic/105089-solved-help-with-array/#findComment-537999 Share on other sites More sharing options...
tbone05420 Posted May 11, 2008 Author Share Posted May 11, 2008 I get it now... I must have been having a bit of a brain f*rt or just too long of a day. So for example to get the 25.45 you would use... $myrate = $var[1]['rates'][0]; Is that correct? Thanks for your help... Tbone Link to comment https://forums.phpfreaks.com/topic/105089-solved-help-with-array/#findComment-538004 Share on other sites More sharing options...
mlin Posted May 11, 2008 Share Posted May 11, 2008 you got it happy coding Link to comment https://forums.phpfreaks.com/topic/105089-solved-help-with-array/#findComment-538072 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.