Guest User

Untitled

a guest
Jul 12th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. $search_conditions = array("conditions" => "name LIKE '%".$search_term."%' OR resturant_name LIKE '%".$search_term."%'");
  2. $res = dish_find($search_conditions);
  3. $res_list = dish_find($search_conditions);
  4. ?>
  5. <select>
  6. <?
  7. while ($rest = mysql_fetch_array($res_list, MYSQL_BOTH)) {
  8. // $list = array($rest["resturant_name"]);
  9. echo '<option>'.$rest["resturant_name"].'</option>';
  10. }
  11. ?>
  12. </select>
  13. <ul class='list'>
  14. <?
  15. while ($row = mysql_fetch_array($res, MYSQL_BOTH)) {
  16. $rating = ($row["avgTaste"] + $row["avgTexture"] + $row["avgSmell"] + $row["avgSize"] + $row["avgPresentation"]) / 5;
  17. ?>
  18. <li id="<? echo $row["resturant_name"] ?>">
  19. <a href="dish.php?id=<? echo $row["id"] ?>">
  20. <span class="photo">
  21. <? if(file_exists("../userImages/".$row['thumb']) && $row['thumb'] != "") {?>
  22. <img src="../userImages/<? echo $row["thumb"] ?>" alt=""/>
  23. <? } else { ?>
  24. <img src="images/missing_dish_image.jpeg" alt=""/>
  25. <? } ?>
  26. </span>
  27. <strong class="dish">Dish: <em><? echo $row["name"] ?></em></strong>
  28. <span class="inf">Restaurant: <em><? echo $row["resturant_name"] ?></em></span>
  29. <span class="inf">Twiddish Rating: <em><? echo $rating ?></em></span>
  30. </a>
  31. </li>
  32. <?
  33. }
  34. if(mysql_affected_rows() == 0){
  35. echo "<h2>We couldn't find what you were looking for please try again.</h2>";
  36. }
  37. //printf("Results: %d\n", mysql_affected_rows());
  38. ?>
  39. </ul>
Add Comment
Please, Sign In to add comment