I want to check if dis is greater or less or between a value. Look at my code, for example, if I got a dis A and val 2, then I will get dis A, but if I got dis A and val 1, then return false because value 1 is not greater than table val 1. My code already can achieve this. But, I don't know how to do the between, e.x, I make two row B on my table, less than 9 and greater than 4. how to check when I have dis B and val is 7, and it is between 4 and 9, and return dis B. Help please. I could alter the table structure if need.
<?php
dis val op
A 1 greater
B 9 less
B 4 greater
D 4 less
SELECT dis
FROM $table
WHERE dis = 'A' AND
CASE WHEN op = 'greater' THEN val < $val ELSE val > $val END//
?>