Jump to content

How do I display this array


PeggyBuckham

Recommended Posts

I used a plugin to create the data in a database, now I am displaying the data and writing code to search/sort. My problem is that I am not familiar with arrays that are put into a single field in a database. I’m not even sure of the correct “name” for data in this format so I can find info about it and learn. So it anyone could please direct me to as tutorial or documentation about this. I would appreciate it. Here is a sample of the code contained in one field of the database.

 

Ultimately I will need to display this data with a <br/> seperateing each element in the array. I also need to understand it better so I can search the fields that are displayed this way. I also really want to learn about it, because I believe it is fairly common and I should understand it  :)

 

a:4:{i:0;s:32:"Green";i:1;s:26:"Red";i:2;s:31:"Blue";i:3;s:33:"Yellow";}

 

Link to comment
Share on other sites

Thank You!!! I was a little desperate so I asked the question on a couple of other forums. Here is a little more inforation that might help out the next person

    * "a:4" says what follows will be an array with 4 elements

    * "i:0" says this is the 0th index in the array

    * "s:32" says what comes next is a string

    * "Green" is that string

    * the rest just follows this pattern

 

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.