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

Link to comment
Share on other sites

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.