Welcome to WebmasterWorld Guest from 18.104.22.168
What I am trying to do is when a user subitted the number, it should actually return values within a certain range which would be (id -1, and id +2).
So, the output would be 4 rows (one below, the closest search value, two rows above the search value).
What would be the easiest way to get such an output?
Any help would be great!
select * from table_name where air_quantity = $_POST['air_quantity'] or
air_quantity = $bottom or air_quantity = $top1 or air_quantity = $top2
Will that work?
Not pretty but it should do the trick.
The problem is, I have certain values such as 45, 55, 80 in the database and if someone puts in 46 it doesn't give me any results.
It should look for the closest matching and then look for the one below and the two upper values and return the 4 values.
$val_below = $usr_val-1;
$val_upper1 = $usr_val+1;
$val_upper2 = $usr_val+2;
$query = "select * from table_name where column_name = '$usr_val' or column_name = '$val_below' or column_name = '$val_upper1' or column_name = '$val_upper2'";
run this query it should work.