Jump to content

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.

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.