Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6378499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:00:54+00:00 2026-05-25T02:00:54+00:00

i insert in database values (array) with use function serialize() , how can echo

  • 0

i insert in database values (array) with use function serialize(), how can echo they with unserialize() in tag <ul><li>...?

i have in database this: a:6:{i:0;s:15:"Coffee";i:1;s:14:"Satellite";i:2;s:11:"Game Notes";i:3;s:14:"Internet";i:4;s:10:"Pool";i:5;s:0:"";}

LIKE:

  • Coffee
  • Game Notes
  • Internet
  • Pool
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:00:55+00:00Added an answer on May 25, 2026 at 2:00 am

    You need to use unserialize(), as you said, with a foreach() loop, like this:

    $arr = unserialize($dbString);
    
    echo "<ul>";
    
    foreach($arr as $key => $val)
    {
        echo "<li>$val</li>";
    }
    
    echo "</ul>";
    

    This will echo a list containing value because foreach() iterates through the unserialize()d array, as you have specified in your question.

    The $key => $part is the icing on the cake for foreach(); if you want the get the array key, simply reference $key. If you want the data for that key, use $val.


    If you want to echo just one element (your example is Internet), just don’t use a loop and reference it by key (integer):

    $arr = unserialize($dbString);
    
    echo $arr[2];
    

    This echos the third element in the array on it’s own.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Informix I can run SQL statement that use other database: INSERT INTO other_db:mytable
I use PDO and i can't insert some data: use this code: $sql =
I want insert in the row from database, array of values as that each
I am trying to insert values in database and values are not being inserted,
I am running a cross server insert INSERT INTO server.database.dbo.table (Field) VALUES('test') Afterward, I
In MS Access Database Insert query to insert the character------> N'tetarnyl I have an
there is insert iterator in database template library or other library, Can someone tell
I do this to save new invoince in my Invoices database table: // insert
I was inserting multiple arrays into my database using this code: $queries_cols = array();
I have this weird problem when trying to INSERT a row into my mysql

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.