I’m trying to make a PDO query to display data.
This is what i have done so far :
in my models/pdo, i created a class with this:
<?php
class VengeanceUsers {
public static function getNumbersOfregistered()
{
$connexion = new PDO("mysql:host=localhost ;dbname=databasetest", 'root', 'passe'); // connexion à la BDD
$var_dump($connexion);
exit();
$resultats=$connexion->query("SELECT COUNT (*) FROM ope_tartine_nl "); // on va chercher tous les membres de la table qu'on trie par ordre croissant
return $resultats;
}
}
?>
In my controller:
$this->view->nb_users = VengeanceUsers::getNumbersOfregistered();
In my view:
Nombre d'inscrits : <?php echo $this->nb_users; ?><br/>
I don’t have anything displayed…
Can anyone help me on this ?
Thanks in advance
exit();out.$var_dump($connexion);you need to remove$in the beginning.For #3 you can use: