Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "";
  5. $dbname = "joes_hot_spot";
  6.  
  7. // Create connection
  8. $conn = mysqli_connect($servername, $username, $password, $dbname);
  9. // Check connection
  10. if (!$conn) {
  11.     die("Connection failed: " . mysqli_connect_error());
  12. }
  13.  
  14. $sql = "SELECT * FROM menu_item";
  15. $result = mysqli_query($conn, $sql);
  16.  
  17. if (mysqli_num_rows($result) > 0) {
  18.     // output data of each row
  19.     while($row = mysqli_fetch_assoc($result)) {
  20.         echo $row['item_name'] . " ";
  21.         echo $row['Item_ID'] . " ";
  22.         echo $row['Item_type'] . " ";
  23.         echo $row['Item_price'] . " ";
  24.         echo $row['Item_description'] . " ";
  25.         echo "<img src='" .$row['item_picture'] . "'></img> ";
  26.     }
  27. } else {
  28.     echo "0 results";
  29. }
  30.  
  31. mysqli_close($conn);
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement