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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:25:28+00:00 2026-06-03T07:25:28+00:00

I have a form where users can search all the entries in a table

  • 0

I have a form where users can search all the entries in a table and i’m having problems with a specific entry.

I’ll give an example for a better understanding:

The user can check 5 boxes: 1, 2, 3, 4, 5 and he checks all the boxes.

If the specific row has the value ‘1|2|3’, my search query won’t find it.

Beforehand i get the post variable in php (which is an array) and add ‘%’ before and after every value. In this case: ‘%1%2%3%4%5%’

My search query:

SELECT id FROM table WHERE string LIKE '%1%2%3%4%5%'

In this case, it won’t find the row with the value ‘1|2|3’.
I guess it’s normal this way and it works great the other way around but I want to perform a query that matches parts of the original string. In my case ‘%1%2%3%4%5%’ to match ‘1|2|3’.

How can i do this?

Thanks in advance for taking the time.

EDIT: Can i do this without multiple AND, OR operators?

  • 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-06-03T07:25:29+00:00Added an answer on June 3, 2026 at 7:25 am

    just change it to this:

    string LIKE '%1%'
      OR
    string LIKE '%2%'
      OR
    string LIKE '%3%'
      ...
    

    this would solve your problem – but you should really think about normalizing your database (in this case, store 5 different flags as 1/0 for the five different settings instead of putting them all together in one field).

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

Sidebar

Related Questions

Let's say I have a form where users can search for people whose name
I have a search form through which users can, well, perform searches. When the
I have a form which users can add controls to and when they right
I have a form where users can modify a collection of objects using a
I have a form where users can add input fields with jQuery. <input type="text"
I have a form where users can enter the names and emails addresses of
I have a form in witch users can add their working hours view them
I have a form where my users can register to my site. They fill
I have a form with 9 text fields where users can input their friends'
I have a form in my django app where users can upload files. How

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.