Advertisement
Guest User

Untitled

a guest
Aug 7th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <?php
  2. $servername = "xxxxxxxxx";
  3. $username = "xxxxxxx";
  4. $password = "xxxxxxxx";
  5. $dbname = "xxxxxx";
  6. $conn = new mysqli($servername, $username, $password, $dbname);
  7. if (!$con) {
  8. die("Connection failed: " . mysqli_connect_error());
  9. }
  10. echo "Connected successfully";
  11. $sql = "SELECT ID, Produto FROM Registo";
  12. $result = mysqli_query($conn, $sql);
  13. if (mysqli_num_rows($result) > 0) {
  14. while($row = mysqli_fetch_assoc($result)) {
  15. echo "ID: " . $row["ID"]. " - Name: " . $row["Produto"]. "<br>";
  16. }
  17. } else {
  18. echo "0 results";
  19. }
  20. mysqli_close($conn);
  21. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement