Advertisement
Guest User

Untitled

a guest
Jul 18th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. include 'con.php';
  2.  
  3. // error_reporting(-1); // reports all errors
  4. // ini_set("display_errors", "1"); // shows all errors
  5. // ini_set("log_errors", 1);
  6. // ini_set("error_log", "php-error.log");
  7.  
  8. // set the PDO error mode to exception
  9. // $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  10.  
  11. function resultat() {
  12.  
  13. global $conn;
  14.  
  15. $stmt = $conn->prepare("SELECT navn, team, art, vaegt, dato FROM indvejninger ORDER by art, vaegt DESC");
  16. $stmt->execute();
  17.  
  18. while ($arr = $stmt->fetch(PDO::FETCH_ASSOC)) {
  19. echo $arr['navn'] . " ";
  20. echo " ";
  21. echo $arr['team'] . " ";
  22. echo $arr['art'] . " ";
  23. echo $arr['vaegt'] . " ";
  24. echo $arr['dato'] . "<br> ";
  25. }
  26.  
  27. }
  28.  
  29. resultat();
  30.  
  31. $hostname = "*";
  32. $database = "*";
  33. $username = "*";
  34. $password = "*";
  35. $options = array(
  36. PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
  37. PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION,
  38. );
  39.  
  40. $conn = new PDO("mysql:host=$hostname;dbname=$database", $username, $password, $options);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement