Skip to content
Advertisement

Search returning no results in “reverse” order

I have a database filled with addresses. 6 columns (id, Name, Address, City, State, Zip, dt)

My code is run with ajax for live search. Currently I can mostly find what I’m looking for with my queries. The problem I’m running into is this. If I search for “90210 Steve Jones” I get no results but if I search for “Steve Jones 90210” it finds the row(s).

Here is my code:

JavaScript

Any help would be appreciated

Advertisement

Answer

One of the solutions is to split the search string by spaces and then do a multiple like comparison operations

So the code is:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement