Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. <?php
  2. $servername = "sql205.byethost18.com";
  3. $username = "b18_22249963";
  4. $password = "Ruby!234";
  5. $dbname = "b18_22249963_Jewels ";
  6.  
  7. // Create connection
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9. // Check connection
  10. if ($conn-<connect_error)
  11. {
  12. die("Connection failed: " . $conn->connect_error);
  13. }
  14.  
  15. $sql = "SELECT id, firstname, lastname FROM MyGuests";
  16. $result = $conn->query($sql);
  17.  
  18. if ($result->num_rows > 0) {
  19. // output data of each row
  20. while($row = $result->fetch_assoc()) {
  21. echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";
  22. }
  23. } else {
  24. echo "0 results";
  25. }
  26. $conn->close();
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement