Jump to content

[SOLVED] Seach Query Help


Zergman

Recommended Posts

Im kinda stuck on this one.  Read through the guides posted, but can't seem to locate the info for my issue.

 

Normally the search queries are no issue, but im building one that will seach for a date range.

 

Right now I have 2 boxes, one for start date and one for end date along with other fields to search.  Issue is that having just the 2 date fields works like a charm, but can't figure out why none of the other boxes will search properly.

 

SELECT * FROM `data` WHERE tdate between '$startdate%' and '$enddate%' AND t2agent LIKE '$t2agent%' and flagent like '$flagent%' ORDER BY tdate

 

Suggestions?

Link to comment
https://forums.phpfreaks.com/topic/128761-solved-seach-query-help/
Share on other sites

'$t2agent%'

this says get everything that STARTS with $t2agent.  Is that what you want?  Most searches search for the phrase anywhere within a word.

 

like if you were searching for 'to' it would return

'tomato', 'atom' etc.

The way yours is written would only return 'tomato' because it starts with 'to'.

Is that what you want?  If not, you need to add % to the beginning of the phrase and not just the end.

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.