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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:07:19+00:00 2026-05-29T22:07:19+00:00

I’m working with PHP and MySQL, and I’m not too experienced with database design.

  • 0

I’m working with PHP and MySQL, and I’m not too experienced with database design. I know the basics of normalization, however my question is about storing vales from a specific form I have.

Ok, so the way my page in question is set up, there are text boxes that can be dynamically added or removed. If the user presses a “+” or “-” button it adds or removes another text box.

Anyway, when I pull the text box values via $_POST it is an array, and then I convert it to a string using implode() Ex: user enters “hello” “world” “bye” “world”, implode converts it to the following string “hello,world,bye,world”.

My question is would it be better to store this string “hello,world,bye,world” in 1 row as 1 entry, or would it be better to break this string into 4 separate strings and store it in 4 different rows? Each text box will contain questions/comments so they could be potentially long and most likely not 1 word like the example I gave.

The reason why I’m asking this is because all of these inputs will be used on the same page, so they can all share a unique ID. Instead of querying multiple times, I’d only have to query once.

  • 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-29T22:07:20+00:00Added an answer on May 29, 2026 at 10:07 pm

    They should be stored separately, because they’re separate examples of one kind of data.

    Your table would be (for example) comments, and each row should be one comment, so one row for hello, one for world, etc.

    You could also store a page ID alongside the comments, so your table would look like this (note that you’d typically have an id field for comment id, as well. I’ve omitted it for brevity):

    |--------------|---------|
    | comment      | page_id |
    |--------------|---------|
    | hello        | 1       |
    | world        | 1       |
    | bye          | 2       |
    |--------------|---------|
    

    Then you can still search on page_id, but your data is logically separated, and you can search on the specific comments if you wish.

    SELECT * FROM comments WHERE page_id = 1 -- 2 results
    

    You can also do things like ordering it alphabetically, or by time (with a new column for that) very easily.

    |--------------|---------|------------|
    | comment      | page_id | time_made  |
    |--------------|---------|------------|
    | hello        | 1       | 1234567890 |
    | world        | 1       | 2356480546 |
    | bye          | 2       | 5168161543 |
    |--------------|---------|------------|
    
    SELECT * FROM comments WHERE page_id = 1 ORDER BY time_made DESC -- most recent first
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I need a function that will clean a strings' special characters. I do NOT
I have a reasonable size flat file database of text documents mostly saved in

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.