Skip to content

Instantly share code, notes, and snippets.

@Jurigag
Created June 12, 2017 18:13
Show Gist options
  • Save Jurigag/802aafe887534636dec570104e6eeae6 to your computer and use it in GitHub Desktop.
Save Jurigag/802aafe887534636dec570104e6eeae6 to your computer and use it in GitHub Desktop.
<?php
$database = "dbname";
$username = "root";
$password = "";
$pdo = new PDO("mysql:dbname=$database;host=127.0.0.1", $username, $password);
$query = "SELECT uczen.imie, uczen.nazwisko FROM uczen";
$result = $pdo->query($query);
require "view.phtml";
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<ol>
<?php foreach($result as $row): ?>
<li><?= $row['imie'] ?> <?= $row['nazwisko'] ?></li>
<?php endforeach; ?>
</ol>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment