projetphp/control/table.php

21 lines
523 B
PHP
Raw Normal View History

<?php
$template = $twig->load('table.html.twig');
try {
$config = include('config.php');
$bdd = new PDO('mysql:host='.$config['host'].';dbname='.$config['dbName'].';charset=utf8', $config['username'], $config['pw']);
} catch (Exception $e) {
die('Erreur : '.$e->getMessage());
}
$reponse = $bdd->query('SELECT * FROM projetphp');
$datas;
for($i=0;$data = $reponse->fetch();$i++) {
$datas[$i] = $data;
}
$reponse->closeCursor();
2019-01-02 19:50:36 +01:00
echo $template->render(array('datas' => $datas, "session" => $_SESSION));
?>