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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:57:34+00:00 2026-05-31T16:57:34+00:00

I have created a search bar for my website, the user may search a

  • 0

I have created a search bar for my website, the user may search a specific category, man or woman etc by a selecting this option from a drop down menu, then entering in a keyword which searches against the selection. The product names all have multiple words, e.g Ultracool Aero Vest or Cyclone Jacket etc…

This is my query, the variable $term is the passed keyword:

$query = "SELECT * FROM PRODUCTS WHERE CATALOGUEID = (SELECT CATALOGUEID FROM PRODUCT_CATALOGUE WHERE PRODUCT_NAME LIKE '%" . $term . "%') AND category1 = 1  ";

Now this works, but I need to enter the entire product name for it to find anything, I am racking my brains trying to figure out how to allow a user to search by entering only one word such as, jacket or vest. I have been researching this and experimenting with regular expressions and wildcards, but I have not been successful, I am not sure if this is even possible. The W3 schools site does show examples of how to search parts of some words, but not multiple words.Any advice is appreciated.

I am editing my question, as I have to inform everyone that I am using SQL server 2008 and cannot use any MySQL syntax. I keep forgetting that I need to distinguish this when posting questions regarding SQL. Apologies.

  • 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-31T16:57:35+00:00Added an answer on May 31, 2026 at 4:57 pm

    I managed to figure out how to do this eventually, all along my problem was using = instead of IN, here is the query now working perfectly, note I am no longer concatenating the keyword wildcard:

    $query = "SELECT * FROM PRODUCTS WHERE CATALOGUEID IN (SELECT CATALOGUEID FROM PRODUCT_CATALOGUE WHERE PRODUCT_NAME LIKE '%?%') AND category1 = 1  ";
    

    Thanks for all your input and help on this.

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

Sidebar

Related Questions

I have a website, I've created with a 'Custom Search' functionality. I set it
I have created a search bar on GAE similar to facebook that shows you
I currently have a page with a search bar. When the user enters something
I have an issue with a search bar I have created, I have no
I have a search bar added in the user interface. The Searchbar is already
I have created a search feature for a site and in addition I made
I have created a keyword search in SQL that takes a list of keywords
I have created a Google Search function, however I would like to leave the
I have created an on the fly search field in Java Swing. I have
Good Morning, I have created an ASP.NET 3.5 webform that allows users to search

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.