Advertisement
Guest User

Untitled

a guest
Oct 9th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. <?php
  2. header('Content-Type: text/html; charset=ISO-8859-1'); //no changes
  3. $servername = "localhost";
  4. $username = "root";
  5. $password = "password";
  6. $dbname = "db_test4";
  7.  
  8. // Create connection
  9. $conn = new mysqli($servername, $username, $password, $dbname);
  10. // Check connection
  11. if ($conn->connect_error) {
  12. die("Connection failed: " . $conn->connect_error);
  13. }
  14. mysqli_set_charset("utf8");
  15. echo "From PHP Script ååååån"; //to see if there is problem when edit the script
  16. $sql = "SELECT * FROM test_tbl";
  17. $result = $conn->query($sql);
  18.  
  19. if ($result->num_rows > 0) {
  20. // output data of each row
  21. while($row = $result->fetch_assoc()) {
  22.  
  23. echo "Kundid: " . $row["kund_id"]. " - Förnamn: " . $row["fnamn"]. " - Efternamn: " . $row["enamn"]. " - Adress:" . $row["adress1"] ."<br>";
  24. }
  25. } else {
  26. echo "0 results";
  27. }
  28. $conn->close();
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement