Jump to content

Seperating search items


Richzilla

Recommended Posts

When conducting a php sql search i get some great results, however i want to expand my results so that when multiple search terms are added it will display all relevant fields.

 

$query = "SELECT * FROM Mixes WHERE dj LIKE '%$var%' OR event LIKE '%$var%' OR tracklist LIKE '%$var%' OR date LIKE '%$var%' ORDER BY event ASC";

 

From the above search i can only get single results from 1 field. I want to be able to seperate the search term into individual items that can be referrenced in the database.

 

So for example i search for a dj name and also an event they play at i get zero results, however if i search for them individually i get the results i want.

 

How do i expand the code to display the result of both the dj and the event or any of the other fields?

 

I presume that i need to be able to set each search item into an individual variable and then use them to search.

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/52267-seperating-search-items/
Share on other sites

I'm not using checkboxes or specific feilds to destinguish between columns. It's just standard search box. I want to search for any number of different values. Effectively i need to use a AND/OR statement for the selection of the fields, however i don't think this is possible.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.