Guest User

Untitled

a guest
Nov 8th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. <?php
  2. class JConfig {
  3. public $dbtype = 'mysqli';
  4. public $host = 'localhost';
  5. public $user = 'xxxx';
  6. public $password = 'xxxx';
  7. public $db = 'xxxx';
  8. public $dbprefix = 'xxxx_';
  9. }
  10.  
  11. <?php
  12.  
  13. include("configuration.php");
  14.  
  15. // Create connection
  16. $conn = mysqli_connect($host, $user, $password, $db);
  17. // Check connection
  18. if (!$conn) {
  19. die("Connection failed: " . mysqli_connect_error());
  20. }
  21.  
  22. $sql = "SELECT id, navn, email FROM XXXX";
  23. $result = mysqli_query($conn, $sql);
  24.  
  25. if (mysqli_num_rows($result) > 0) {
  26. // output data of each row
  27. while($row = mysqli_fetch_assoc($result)) {
  28. echo "id: " . $row["id"]. " - Name: " . $row["navn"]. " " . $row["email"]. "<br>";
  29. }
  30. } else {
  31. echo "0 results";
  32. }
  33.  
  34. mysqli_close($conn);
  35. ?>
  36.  
  37. public $dbtype = 'mysqli';
  38. public $host = 'localhost';
  39. public $user = 'xxxx';
  40. public $password = 'xxxx';
  41. public $db = 'xxxx';
  42. public $dbprefix = 'xxxx_';
Add Comment
Please, Sign In to add comment