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

  • Home
  • SEARCH
  • 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 6040357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:30:09+00:00 2026-05-23T06:30:09+00:00

I’m developing a website where users will be able to save in their profile

  • 0

I’m developing a website where users will be able to save in their profile a list (array) of items (which they can find also in the same website and have their own id).

This is the way I’ve used so far in similar situations:
– Create a ‘text’ (string) field in the users table in the DB and save the items separated by commas
– To read that field, use the explode method to get the array in CakePHP and then work with it
– To save the array to the DB, use the implode method to convert it to a string and be able to store it in the field

What I dont’ like about this method is that it can get really complicated to deal with those lists (add items, remove items…) and you can’t really access those items directly, there’s always some pre-processing or post-processing to make.

For example, to make it easier to look at a specifc item in one user’s list and find other users with the same item in their lists.

Is there any better way to deal with arrays in CakePHP+MySQL? I’ve read about serialize()/unserialize(), but I don’t think that would make a big difference compared to the other method…

Thank you very much in advance for any ideas!

  • 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-23T06:30:10+00:00Added an answer on May 23, 2026 at 6:30 am

    A database table is just a huge spreadsheet. But instead of storing one piece of information in each cell, you clump them all together in one cell. You would never do that in spreadsheet.

    You should create an item table like this:

    +----+--------+--------+
    | ID | UserID | ItemID |
    +----+--------+--------+
    | 1  | 2      | 3      |
    | 2  | 2      | 1      |
    | 3  | 3      | 3      |
    +----+--------+--------+
    

    And possibly another table:

    +----+-------------+
    | ID | ItemName    |
    +----+-------------+
    | 1  | Mathematics |
    | 2  | Jogging     |
    | 3  | Movies      |
    +----+-------------+
    

    That’ll let you know that User 2 likes Movies and Mathematics, and User 3 likes Movies.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
I have just tried to save a simple *.rtf file with some websites and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but

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.