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
|
$requete="SELECT * FROM LIVRES WHERE " . $type_recherche . " LIKE '%%" . $terme_recherche . "%%'";
//$requete="SELECT * FROM LIVRES";
$resultat = $db->query($requete);
$nbLig = $resultat->num_rows;
if (!$nbLig)
echo "Aucun livre trouvé  !<br />";
else
echo "<p>Nombre de livres trouvés : " . $nbLig . "</p>";
for ($i = 0; $i < $nbLig; $i++)
{
$ligne = $resultat->fetch_object();
echo "<p><strong>" . ($i+1) . ". Titre : ";
echo htmlspecialchars(stripslashes($ligne->titre));
echo "</strong>";
echo "<br />Auteur : ";
echo stripslashes($ligne->auteur);
echo "<br />isbn : ";
echo stripslashes($ligne->ISBN);
echo "<br />prix : ";
echo number_format($ligne->prix,2);
echo '</p>';
}
$resultat->free();
$db->close(); |
Partager