Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. <?php
  2. include'IngredientCodes.php';
  3. include'connect.php';
  4. $ingredient_array = array();
  5. // check if any of the checkboxes were checked
  6. if(isset($_POST['check_list'])){
  7. // add each value from HTML check_list array to PHP ingredien_array.
  8. foreach($_POST['check_list'] as $value){
  9. array_push($ingredient_array, $value);
  10. }
  11. }
  12. $recipe_query = "SELECT RecipeURL, Count(1) as 'Likeness'
  13. FROM Recipes R, (SELECT * FROM Ingredients WHERE IngredientCode in (0,1)) I #List of selected Ingredients
  14. WHERE R.RecipeID = I.RecipeID AND R.RecipeID NOT IN (SELECT RecipeID FROM Ingredients WHERE IngredientCode in (1)) #Exclusion list
  15. GROUP BY RecipeURL
  16. ORDER BY Likeness desc";
  17. $result = mysqli_query($conn, $recipe_query);
  18.  
  19. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement