Affichage des enregistrement avec php 5 PDO
salut à tous,
voilà mon problème se situe au niveau d'affichage des enregistrement de ma table avec php 5 en PDO voilà mon code :
page "MyPDO.class.php"
Code:
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
| <?php
class MyPDO extends PDO
{
private $connection = false; //Instance PDO
public function __construct()
{
$base='bibliothèque';
//Connexion au serveur
$dsn="mysql:host=localhost;dbname=".$base;
$user='root';
$pass='';
try
{
$this->connection = parent::__construct($dsn,$user,$pass);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e)
{
echo "Échec : " . $e->getMessage();
}
}
}
?> |
page "index1.php"
Code:
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
| <title>Administration--Accueil</title>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
<h2><mark>Administration</mark></h2>
<hr>
<p> :: accueil</p>
<Form action="index1.php" method="post">
<input type="text" name="motclef" value="">
<input type="submit" value=" Rechercher ">
</Form>
<p>
<table>
<tr id="entetetab">
<td><b>Titre</b></td><td><b>Nom</b></td>
<td><b>Prénom</b></td><td><b>Date de Naissance</b></td><td><b>Adresse</b></td><td><b>Code Postal</b></td><td><b>Email</b></td><td><b>Mot de Passe</b></td>
</tr>
<?php
include_once("MyPDO.class.php");
$idcom=new MyPDO();
$req="SELECT `id_ad`, `Nom`, `Prenom`, `Date_n`,'Adresse','Code_p','Tel','Email','Mp' FROM `adherant`";
$oPDOStatement=$idcom->query($req);
$oPDOStatement->setFetchMode(PDO::FETCH_OBJ);
while ($row = $oPDOStatement->fetch())
{
echo "<tr>";
foreach($row as $donn)
{
echo "<td>$donn</td>";
}
}
[
$idcom=NULL;
?>
</table>
</body>
</html> |
mais toujours il m'affiche le message d'erreur suivant :
Citation:
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'C:/Program Files/EasyPHP-12.1/www/my portable files/Bibliothèque/index1.php' (include_path='.;C:\php\pear') in Unknown on line 0