Jump to content

[SOLVED] Help With Array


tbone05420

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.