0

Hi All....
how to search by price range

----------------------------------------
id price  |   range_type  |  min  |  max
----------------------------------------
1         |  A1           | 1     | 100
2         |  A2           | 101   | 200
----------------------------------------
3         |  B1           | 151   | 250
4         |  B2           | 251   | 400
-----------------------------------------

Ex:
if the numbers are in included in the search is

Example : $search = 50
if $search > 1 and < from 100 "output range_type = A1"
-------------------------------------------------------
Example : $search = 160
output = range_type = A2 and B1
--------------------------------------------
Example : $search = 201
output  = range_type = B1
-----------------------------------------------

Th'x

Edited by weeon: n/a

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by weeon
0

Use this query;

SELECT range_type  FROM tablename WHERE $var >= min AND $var <= max

where;

  • tablename is name of your table
  • $var is the variable containing the users input
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.