# Correct PHP syntax for Greater but Less than

**URL:** <https://forum.kirupa.com/t/correct-php-syntax-for-greater-but-less-than/284726>\
**Category:** programming\
**Created:** [March 23, 2009, 12:16am UTC](https://forum.kirupa.com/t/correct-php-syntax-for-greater-but-less-than/284726 "2009-03-23T00:16:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimjiminyjimjim](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jimjiminyjimjim](https://forum.kirupa.com/u/jimjiminyjimjim)\
**Post date:** [March 23, 2009, 12:16am UTC](https://forum.kirupa.com/t/correct-php-syntax-for-greater-but-less-than/284726/1 "2009-03-23T00:16:25Z")

</div>

I need to be able to search for cars from a database dependent on price when a user selects a certain price bracket.

I have something like this but I don’t think its right.

```php
$query = "SELECT * FROM cars
			WHERE price >= '%".$lower."%' && price <= '%".$higher."%' ORDER BY make";

```

All l need is a query that selects, for example, all cars that cost from £100 to £150.

Any help much appreciated.
