print $section_header ?>
$init = 0; if(!$_POST) { $Query = "SELECT * FROM recipes WHERE category LIKE '%$section%' && approval = 'y' ORDER BY title ASC"; } else { $category = $_POST['category']; /// peach, plum, pear, cherry, grape $type = $_POST['type']; /// appetizer, dessert, main, starter $keywords = $_POST['keywords']; /// appetizer, dessert, main, starter if($keywords == 'Search for Recipe') { $keywords = 'Enter Keywords'; } if($keywords == 'Enter Keywords') { $keywords = ''; } $keywords = str_replace(' ',',',$keywords); $keywords_array = explode(',',$keywords); $search_within = array('title','keywords','description','ing_ingredient','directions'); foreach($keywords_array as $key => $val) { if($key > 0) { $keywords_search .= ' && '; } $keywords_search .= " (title LIKE '%".$val."%' || "; $keywords_search .= "keywords LIKE '%".$val."%' || "; $keywords_search .= "description LIKE '%".$val."%' || "; $keywords_search .= "ing_ingredient LIKE '%".$val."%' || "; $keywords_search .= "directions LIKE '%".$val."%') "; } //print $keywords_search; $Query = "SELECT * FROM recipes WHERE category LIKE '%$section%' && type LIKE '%$type%' && (".$keywords_search.") && approval = 'y' ORDER BY title ASC"; } $dbResult = mysqli_query($con,$Query); $num_results = mysqli_num_rows($dbResult); //print $num_results; while($row = mysqli_fetch_array($dbResult)) { $init++; $recipe_id = $row['id']; $recipe_title = $row['title']; $recipe_thumb = $row['thumb']; ?>print $recipe_title ?> |
Sorry, no recipes found that match your criteria.
Please adjust your serach terms on the right.
} ?>Refine Search
Select the appropriate options below to further refine your search