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
| <?php
class Voir_mp
{
private $pseudo ;
public function __construct($pseudo)
{
$this->$pseudo = $pseudo;
}
public function check_new_mp()
{
$connexion = new PDO('mysql:host='.HOST_MYSQL.';dbname='.BDD_MYSQL, USER_MYSQL, MDP_MYSQL);
$q=$connexion->prepare('SELECT * FROM mp WHERE lower(pseudo_dest) =:pseudo');
$q->execute(array('pseudo' => strtolower($this->pseudo)));
if ($q->rowCount())
return true ;
else
return false ;
}
public function liste_mp()
{
try { $connexion = new PDO('mysql:host='.HOST_MYSQL.';dbname='.BDD_MYSQL, USER_MYSQL, MDP_MYSQL);
$connexion->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$q=$connexion->prepare('SELECT * FROM mp WHERE lower(pseudo_dest) =:pseudo');
$q->execute(array(':pseudo' => strtolower($this->pseudo)));
$array = $q->fetch(PDO::FETCH_ASSOC) ;
return $array ;
$q->closeCursor();
}
catch(PDOException $e)
{
echo 'Erreur : '.$e->getMessage().'<br />';
echo 'N° : '.$e->getCode();
}
}
}
?> |