doing convert to views and add login page
This commit is contained in:
20
control/table.php
Executable file
20
control/table.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?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();
|
||||
echo $template->render(array('datas' => $datas));
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user