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 6601595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:46:28+00:00 2026-05-25T18:46:28+00:00

I am trying to store a bunch of features in a database. The format

  • 0

I am trying to store a bunch of features in a database. The format I was thinking was to insert it like this:

Stuff Here|Separated By That|More Stuff|And some more

Now, I will need to grab that from the database and make it into a list like:

<ul>
    <li>Stuff Here</li>
    <li>Separated By That</li>
    <li>More Stuff</li>
    <li>And some more</li>
</ul>

Will that be easy to do? I know I can do:

str_replace("|", "<li>", $data);

but then that wouldn’t work for the very first item and the last item, plus closing tags. Is there anoher way I should be inserting my list into the database? Or is this way fine, and I just need the correct code to format the unordered list better?

  • 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-25T18:46:29+00:00Added an answer on May 25, 2026 at 6:46 pm

    I don’t think there’s a single-line piece of code you can use to do that (would love to be corrected), so yes, store your data as you currently are in the database and write a small helper function to split up the string and build the HTML list.

    function build_list($string) {
      $output = '<ul>';
      $items = explode('|', $string);
      foreach ($items as $item) {
        $output .= '<li>' . $item . '</li>';
      }  
      $output .= '</ul>';
    
      return $output;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to store a password in a file that I'd like to retrieve
I'm trying to store member function pointers by templates like this: (This is a
I am trying to store more than 1 data item at a single index
I am trying to store a large amount of boolean information that is determined
I'm trying to store a lightly filtered copy of a database for offline reference,
I am trying to store/retrieve a value that is stored in the Application Settings.
I am trying to run a program that analyzes a bunch of text files
I'm trying to design a database to store player statistics for multiple types of
I'm trying to design a MySQL database to store user zipcode preferences for providing
I am trying to best figure out a way to store this particular case

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.