Bonjour
je suis en train de faire la conception d'une base de données sous mysql / php,
à l'étape de la connexion, ça me met ce message d'erreur:
Fatal error: Uncaught Error: Call to a member function fetch() on boolean in /opt/lampp/htdocs/Form/admin/index.php:44 Stack trace: #0 {main} thrown in /opt/lampp/htdocs/Form/admin/index.php on line 44
voici ma ligne 44 sur index.php:
while($item = $statement->fetch())
en fin, je vous mets le code en entier:
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 69 70 71 72 73 74 75 76 77 78
| <!DOCTYPE HTML>
<html>
<head>
<title>Formation Competence Center</title>
<meta charset="utf-8" />
<meta name="viewport" content="width-device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href='http://fonts.googleapis.com/css?family=Hanging-Letters' rel='stylesheet' type='type=text/css'>
<link rel="stylesheet" href="../css/Style.css">
</head>
<body>
<h1 class="text-logo"><span class="glyphicon glyphicon-file"></span> FORMATIONS <span class="glyphicon glyphicon-file"></span></h1>
<div class="container admin">
<div class="row">
<h1><strong>Liste des utilisateurs </strong><a href="insert.php" class="btn btn-success btn-lg"><span class="glyphicon glyphicon-plus"></span> Ajouter</a></h1>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Identifiant</th>
<th>Mot de passe</th>
<th>Photo</th>
<th>Nom d'utilisateur</th>
<th>Prenom d'utilisateur</th>
<th>Date de naissance</th>
<th>Adresse</th>
<th>Ville</th>
<th>Email</th>
<th>Etat</th>
</tr>
</thead>
<tbody>
<?php
require 'database.php';
$db = Database::connect();
$statement = $db->query('SELECT items.id, items.mot de passe, items.photo, items.nom d&utilisateur, items.prenom d&utilisateur, items.date de naissance, items.adresse, items.ville, items.email, items.etat
FROM items LEFT JOIN categories ON items.category = categories.id
ORDER BY items.id DESC');
while($item = $statement->fetch())
{
echo '<tr>';
echo '<td>' .$item['Id'] .'</td>';
echo '<td>' .$item['Mot de passe'] .'</td>';
echo '<td>' .$item['Photo'] .'</td>';
echo '<td>' .$item['Nom d&utilisateur'] .'</td>';
echo '<td>' .$item['Prenom d&utilisateur'] .'</td>';
echo '<td>' .$item['Date de naissance'] .'</td>';
echo '<td>' .$item['Adresse'] .'</td>';
echo '<td>' .$item['Ville'] .'</td>';
echo '<td>' .$item['Email'] .'</td>';
echo '<td>' .$item['Etat'] .'</td>';
echo '<td width=300>';
echo '<a class="btn btn-default" href="view.php?id=' .$item['id'] . '"><span class="glyphicon glyphicon-eye-open"></span> Voir</a>';
echo '<a class="btn btn-primary" href="update.php?id=' .$item['id'] . '"><span class="glyphicon glyphicon-pencil"></span> Modifier</a>';
echo '<a class="btn btn-danger" href="delete.php?id=' .$item['id'] . '"><span class="glyphicon glyphicon-remove"></span> Supprimer</a>';
echo '</td>';
echo '</tr>';
}
?>
</tbody>
</body>
</table>
</html> |
Partager