Essentially what I want to do is make a selection on data displayed based upon a users status when logged in, for example if the user is a trial user then select data from a specific date range but if they are a paid user then select a greater date range. I have tried the following code below but it throws up an error saying my syntax is incorrect. Any help would be greatly appreciated.
IF (SELECT MemberStatus FROM user WHERE Memberstatus = 'Trial')
THEN
SELECT *
FROM article
WHERE date > '1990/01/01';
ELSE
SELECT *
FROM article
WHERE date > '2000/01/01';
ENDIF;
I think it’s wrong to do this (check user status and select items depending on it) in one query. You’ll probably need to use trial restrictions or display trial status somewhere else in your code. So better to store it in instance of user’s profile or a varialble and build queries regarding user’s status.