Friday, 9 August 2013

mysql SELECT price range php

mysql SELECT price range php

I would like to return rows matching the user input for price.. from $ to $.
<form action="" method="post">
<input class="price" name="p1" type="text"> to <input class="price"
name="p2" type="text"> <br>
<input type="submit" name="sprice" value="go" >
</form>
Here is the select query. It doesn't return rows depending on the price
range.
if (isset($_POST["sprice"]) && (!empty($_POST["p1"])) &&
(!empty($_POST["p2"]))){
$p1 = $_POST["p1"];
$p2 = $_POST["p2"];
$paginate = new pagination($page, 'SELECT * FROM test where price BETWEEN
"$p1" AND "$p2" ORDER BY id desc', $options);
}

No comments:

Post a Comment