Commit 98e5cc1e authored by Clement GAUDUCHEAU's avatar Clement GAUDUCHEAU
Browse files

recherche d'auteurs frequents effectués

parent 830763a9
<?php
class AuteursFrequents{
private $connexion;
public function __construct(){
try{
$this->connexion=new PDO("mysql:host=".HOST."; dbname=".BD, LOGIN, PASSWORD, array(PDO::MYSQL_ATTR_INIT_COMMAND=>"SET NAMES utf8"));
}catch(PDOException $e){
die($e->getMessage());
}
}
public function incrementerNbRecherche($auteur){
$request="UPDATE `auteurs` SET nbRecherche=nbRecherche+1 WHERE nom_auteur like ?";
$statement=$this->connexion->prepare($request);
$paramAuteur="%".$auteur."%";
$statement->execute(array($paramAuteur));
}
public function get10Auteurs(){
$request="select nom_auteur from auteurs where nbRecherche>0 order by nbRecherche desc LIMIT 0,8";
$statement=$this->connexion->query($request);
$result=$statement->fetchAll(PDO::FETCH_ASSOC);
return $result;
}
}
?>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment