Zergman Posted October 16, 2008 Share Posted October 16, 2008 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? Quote Link to comment Share on other sites More sharing options...
CroNiX Posted October 16, 2008 Share Posted October 16, 2008 '$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. Quote Link to comment Share on other sites More sharing options...
Zergman Posted October 16, 2008 Author Share Posted October 16, 2008 LOL, splendid, didn't even realize I did that. Fixed, thx CroNiX! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.