SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Feb 2011
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to search in fields

    Hello,

    i have a varchar field named featuresIDs in my table.

    I save selecteds features Id's for the project in it with comma seperated.

    The values in it like 1,2,10,42,45 ; 5,30,45

    Now i want to search for; For example 2,42 or 1,45 in that field.

    How do i make it.

    I don't want to first take all records and than make a foreach loop with php.

    Thank you

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,508
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Normalize your database and get rid of columns that contain multiple, comma separated values. Instead, create a new table, projectfeatures, which will contain a row for each project-feature combination.

  3. #3
    SitePoint Member
    Join Date
    Feb 2011
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you advice me to get result by "JOİN". Right?

    That way, i have to change a bunch of things

    isn't there an any solution else? like REGEXP

  4. #4
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,708
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Normalize your data, change the bunch of things instead.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •