Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $criteria = array();
- if (isset($_POST['calories'])) {
- $criteria[] = 'calories < '.$_POST['calories']);
- }
- if (isset($_POST['time'])) {
- $criteria[] = 'cooking_time < '.$_POST['time']);
- }
- ...
- $query = 'SELECT * FROM recipes WHERE '.implode(' AND ', $criteria);
Add Comment
Please, Sign In to add comment