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

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

Ok...Thank's

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.