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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:11:17+00:00 2026-06-17T17:11:17+00:00

What I am trying to do: Multi word search, and when the user selects

  • 0

What I am trying to do: Multi word search, and when the user selects pub from the drop down it needs to only retrieve records where pub is not equal to ‘-‘ in the table.

What’s going wrong: It does some filtering but the last record is a record with a ‘-‘

What I have tried:

I’ve tried the following query in the MySQL console.

My query:

SELECT * FROM ticker where pub <> '-' AND (summary LIKE '%funny%' OR cust_exp LIKE '%funny%') OR (summary LIKE '%joke%' OR cust_exp LIKE '%joke%') OR (summary LIKE '%impact%' OR cust_exp LIKE '%impact%') ORDER BY `created` DESC

The above query is generated via:

constructing the multi-word search..

$words = explode(" ",$keywords);

        $queryWords = '';
        $i=0;  

        foreach($words as $each){
            $i++;

            if ($i == 1){
                $queryWords.=" (summary LIKE '%$each%' OR cust_exp LIKE '%$each%') ";   
            }
            else{
                $queryWords.=" OR (summary LIKE '%$each%' OR cust_exp LIKE '%$each%') ";    
            }
          }

snippet of query code..

elseif ($ticket_type == 'Pub'){
                if ($status == 'All'){
                        if (empty($product)){
                            $query="SELECT * FROM ticker where pub <> '-' AND".$queryWords."ORDER BY `$order_by` DESC";
                        }

EDIT: Sample search string is ‘funny joke impact’

  • 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-17T17:11:18+00:00Added an answer on June 17, 2026 at 5:11 pm

    Try this:

    SELECT * FROM ticker 
    WHERE TRIM(pub) != '-' 
      AND (
        (summary LIKE '%funny%' OR cust_exp LIKE '%funny%') 
        OR
        (summary LIKE '%joke%' OR cust_exp LIKE '%joke%')
        OR 
        (summary LIKE '%impact%' OR cust_exp LIKE '%impact%')
      ) 
    ORDER BY `created` DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to enable multi-word search with google app engine. However there appears an
I hwas trying to generate a multi page XPS document from a web application
I am trying to develop multi-streaming H.264 video player based on cudaDecodeD3D9 example from
I'm trying to share multi-module Maven project (using m2eclipse plug-in) from SpringSource Tool Suite
I'm trying to build a simple interface for an assignment, in which multi-line word-wrapped
New to python and trying to understand multi-threading. Here's an example from python documentation
i'm trying to get multi tenancy working in my app - using nhibernate integration
I am trying to debug a multi-threaded Android app on a 2.3.6 device using
I am trying my hardest to learn Cross/Multi Threading, but I am very confused
I am trying to store a multi dimensional (2 dimension) array in JavaScript phonegap

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.