variables in a select statement |
variables in a select statement |
seattletype |
Aug 12 2015, 12:22 PM
Post
#1
|
Group: Members Posts: 2 Joined: 12-August 15 Member No.: 23,284 |
I've built a search form in essence, where the form has several variables to be passed to the select statement. There's a uniqueID, a typeID and two date fields where a user can search between the two dates. THe form works fine if only searching on either of the IDs, and it works fine if searching between two dates, but when I put them all together in the select statement, none of them work. I'm sure it's just a grammar thing, but I don't know the answer. I was hoping it was going to be something like this: (where $from and $to were assigned values from the form - this works, by the way)
SELECT * FROM Res WHERE (RID LIKE ? OR Type LIKE ? OR (DateField BETWEEN '$from' AND '$to')) ORDER BY RID but.. that doesn't work. Help?? |
Lo-Fi Version | Time is now: 28th April 2024 - 11:31 AM |