Jump to content

Recommended Posts

Is it possible to query multiple columns at the same time using only one search term..

 

Lets say I want to make a search box, and just a search box on my site for items i have in my database.. Rather then have the user type a keyword or 2 out in one box and select from a drop down next to it to select a "Type" of search. Where in choosing the "Type" my query would search a specific column. I would rather they just type and hit the search button, and have it search across multiple columns at once. But im not sure if thats possible.. the books I have don't cover it, and im not exactly sure what I should look for in a Search to find the type of query I would need to preform, if it even is possible.

 

In other words..

Table (7 columns)...

User types in Keyword, hits search...

I want my query to search only 3 of the columns on the 7 column table based on the keyword or words that the user provides. Chances are I will need to use a wildcards as well...

 

if the search yields any results from any or all of the 3 columns then I want to list them out, like I would otherwise with a single column search.

Link to comment
https://forums.phpfreaks.com/topic/198482-multiple-column-search-one-query/
Share on other sites

Understood that there is a mysql forum or section rather, but this pertains to PHP as well seeing as I am structuring my query through PHP, and am seeking to know if its possible.

 

No, this is a MySQL question. How you create the query is inconsequential to the question of how the query should be formatted. [Moving to appropriate forum]. Besides, the solution has already been provided.

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.