Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include 'con.php';
- // error_reporting(-1); // reports all errors
- // ini_set("display_errors", "1"); // shows all errors
- // ini_set("log_errors", 1);
- // ini_set("error_log", "php-error.log");
- // set the PDO error mode to exception
- // $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- function resultat() {
- global $conn;
- $stmt = $conn->prepare("SELECT navn, team, art, vaegt, dato FROM indvejninger ORDER by art, vaegt DESC");
- $stmt->execute();
- while ($arr = $stmt->fetch(PDO::FETCH_ASSOC)) {
- echo $arr['navn'] . " ";
- echo " ";
- echo $arr['team'] . " ";
- echo $arr['art'] . " ";
- echo $arr['vaegt'] . " ";
- echo $arr['dato'] . "<br> ";
- }
- }
- resultat();
- $hostname = "*";
- $database = "*";
- $username = "*";
- $password = "*";
- $options = array(
- PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
- PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION,
- );
- $conn = new PDO("mysql:host=$hostname;dbname=$database", $username, $password, $options);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement