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
|
class Mycv{
private $dbhote = '',
private $dbbase = '',
private $dbuser = '',
private $dbpass = '',
private $dsn = '';
private $dbh = '';
public function __construct($dbhote = 'localhost', $dbbase = 'test', $dbuser = 'root', $dbpass = '')
{
$this->dbhote = $Serveur;
$this->dbbase = $Bdd;
$this->dbuser = $Identifiant;
$this->dbpass = $Mdp;
$this->dsn = 'mysql:dbname=$this->dbbase;host=$this->dbhote';
$this->dbh = new PDO($this->dsn, $this->dbuser, $this->dbpass);
}
public function viewData(){
$sql = 'SELECT * FROM fic_opex_cla';
$res = $this->dbh->query($sql);
while($row = $res->fetch(PDO::FETCH_NUM)){
echo $row[1].'<br/>';
}
}
}
$test = new Mycv();
$test->viewData(); |
Partager