Jump to content

retrieving json data and cache it for future reference


php_begins

Recommended Posts

My function returns a bunch of attribute ids and it's corresponding names in json format. For eg:

 

 

  {
        "DETAILS": [
            {
                "ATTR_ID": "522",
                "ATTRIBUTE_ID": "4222",
                "ATTRIBUTE_TYPE": "email",
    
            },
            {
                "ATTR_ID": "523",
                "ATTRIBUTE_ID": "4006",
                "ATTRIBUTE_TYPE": "interest",
    
    
            }
        ]
    }

 

I need to store it in an array which i need to cache .( I'll be probably using $_SESSION)

 

Now another function returns me set of attribute ids:

 

 

  $val_array = $subarray[arrayOfAttributes];
    	foreach ($val_array as $val)
    	{
    		print "Attrib Value: $val\n"; //This will print ids 4222,4223,etc
    	}

what I need to do is correspond the ids with the type from the cache nad print out the respective Types.

I am unable to formulate this logic into code.

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.