1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<title>xxxxxxx</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container">
<?php
// Connexion à la base de données
try
{
$bdd = new PDO('mysql:host=localhost;dbname=jplyne', 'root', '');
}
catch(Exception $e) { die('Erreur : '.$e->getMessage()); }
$nombreDeMessagesParPage = 10;
$retour = $bdd->query('SELECT COUNT(*) AS id FROM test');
$donnees = $retour->fetch();
$totalDesMessages = $donnees['id'];
?>
<br /> <br />
<?php
echo'Il existe <strong> ' . $totalDesMessages . ' </strong> bourses.'; ?>
<?php
$nombreDePages = ceil($totalDesMessages / $nombreDeMessagesParPage);
echo 'Page : ';
for ($i = 1 ; $i <= $nombreDePages ; $i++)
{
echo '<a href="pdo.php?page=' . $i . '">' . $i . '</a> ';
}
if (isset($_GET['page']))
{$page = intval($_GET['page']);}
else { $page = 1;}
?>
<table>
<h1> collection 2009</h1>
<thead>
<tr>
<th class="produit">Produit</th>
<th class="mdp">mdp</th>
<th class="prix">Prix</th>
</tr>
</thead>
<?php
$premierMessageAafficher = ($page - 1) * $nombreDeMessagesParPage;
$reponse = $bdd->query('SELECT pseudo, mdp FROM test ORDER BY id LIMIT ' . $premierMessageAafficher . ', ' . $nombreDeMessagesParPage);
while ($donnees = $reponse->fetch())
{
?>
<tr>
<td><strong><a href="detailb2009.php?id=<?php echo htmlspecialchars($donnees['id']); ?>"><?php echo htmlspecialchars($donnees['pseudo']); ?></a></td>
</strong>
<td><?php echo $donnees['mdp'];?><br/></td></tr>
<?php
}
$reponse->closeCursor();
?>
</table>
</div>
</body>
</html> |