You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 1, 2025. It is now read-only.
$db= new \PDO(DB_HOST, DB_USER, DB_PASS, array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION));
return$db;
}
publicfunctionlistAll()
{
$db = $this->getDbConnect();
$req = $db->prepare('SELECT * FROM animal LIMIT 25');
$req->execute();
return$req->fetchAll();
}
publicfunctionlistSomeAnimals()
{
$db = $this->getDbConnect();
$req = $db->prepare('SELECT animal.nom, espece.nom_courant FROM `animal` INNER JOIN espece ON espece.id = animal.espece_id ORDER BY animal.nom DESC LIMIT 10');
$req->execute();
return$req->fetchAll();
}
publicfunctionaddAnimal($name) //test pour une requête POST, mais ne marche pas encore
{
$db = $this->getDbConnect();
$req = $db->prepare('INSERT INTO animal(nom, espece_id) VALUES (?,?)');