Hello,
I am working on something and it's a database with a list of book titles and years they have been published, I need to get the books that have been written for 1880 from the database only and with my code it shows all of the books with all the years, please help.
My code:
I am sorry that somethings are in an other language (dutch). Thanks in advance!
PS: jaar = year, BoekNummer =ID in the database and title = title
I am working on something and it's a database with a list of book titles and years they have been published, I need to get the books that have been written for 1880 from the database only and with my code it shows all of the books with all the years, please help.
My code:
Code:
<?php
$db = new PDO('mysql:host=localhost;dbname=boekenlijst','root','');
$sql = "SELECT BoekNummer, Jaar, Titel FROM boeken";
$resultaat = $db->query($sql);
echo '<table border = 1>';
foreach($resultaat as $row) {
echo '<tr>';
$nummer = $row['BoekNummer'];
echo '<td>'.$row['BoekNummer'].'</td>';
echo '<td>'.$row['Titel'].'</td>';
echo '<td>'.$row['Jaar'].'</td>';
}
echo '</table>';
$db= NULL;
?>
PS: jaar = year, BoekNummer =ID in the database and title = title
Comment