I'm trying to allow users to view only certain records, where query variables are given by the user using a form. The form contains a datepicker and 3 select-elements where users can select multiple options, the allowed options are populated by SQL using SELECT DISTINCT
.
The date selection works, but the SELECT-list only works when one value is selected. I feel that the problem is being caused by incorrect SQL on the 'results' page. I don't know how to make SQL work with a comma delimited string (example: user1, user2, user3 etc. This is my SQL query:
SELECT *
FROM exp_core
WHERE `time` >= startdate
AND `time` <= enddate
AND user LIKE uservar
AND type LIKE typevar
AND trnsact LIKE trnsactvar
uservar
, typevar
and trnsactvar
are comma delimited form variables. Who knows how to make SQL treat these values as separate values?