Jump to content

Storing an array of id's in the database?


Solarpitch

Recommended Posts

Hey Guys,

In my application I have a "quicklist" which stores a few id's of products on the site. Each product the user selects will be added to this quicklist variable.

ie $quicklist[] = {4,5,42,6,17,64} --> each id is a reference to a product.

I want to be able to give the user the option of saving the quicklist to the database for later viewing. So I want to sore all the id's the user has selected . . {4,5,42,6,17,64}. Then when the user wishes to view his/ her quicklist, I can pull them from the DB and display in a table.

How could I achieve this?

Cheers,
Gerard.
Link to comment
Share on other sites

Well, using an IN() clause, you could easily pull them back, especially if you store it with commas already.  Not that I condone storing lists of values in database fields, but as long as you never want them to be able to edit a quicklist, I might make an exception.
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.