Jump to content

Best Way To Search?


Winter0Star

Recommended Posts

Going to make a site here soon and I need a little help.

 

I will be storing an array of ID's into a MySQL database.  I'm using the serialize function to store the array (however, I can change this if there is a better way).  However, I want to be able to search for ID's directly through the MySQL statement.

 

For example, I need to search for ID "254".  I can't search through the serialized information unless I pull it out first.  I want to be able to do something like this...

 

SELECT name FROM table WHERE id_list = '$id'

 

I'm looking for the best way to directly search for an ID.  I hope this makes sense.

Link to comment
Share on other sites

instead of storing an array of id's into your database using serialize, why not create a field for storing your id's, and make it the primary key. If this is the way you would like to do it, your select mysql statement will be valid

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.