<?php

	class Connect {
			
		private $serveur, $user, $motDePass, $dataBase;
		protected $pdo;
		
		public function __construct($mbd){
		    
			$this->serveur = "localhost";
			$this->user = "kelasion_michel";
			$this->motDePass = '))p+wm$XebjK';
			$this->dataBase = ''.$mbd.'';
			$this->pdo = new PDO('mysql:host='.$this->serveur.';dbname='.$this->dataBase, $this->user, $this->motDePass);
			
			/*$connectstr=array('mysql:host='.$this->serveur.';dbname='.$this->dataBase, $this->user, $this->motDePass);
			$this->pdo = new PDO($connectstr);*/
			
		}
		
		public function myDB($mbd){
			$nomDB = $mbd;
			return $nomDB;
		}
		
		public function toString(){
			return $this->dataBase.'  '.$this->serveur;
		}
		
		function connect_db($mbd){
		try{
			$bd = new PDO('mysql:host=localhost;dbname='.$mbd.'','kelasion_michel','))p+wm$XebjK');
		}
		catch(PDOException $e){
			echo "Impossible de se connecter !";
		}
		return $bd;
		}
		
	}		
	
	
	
	/*class Connect {
		
		private $serveur, $user, $motDePass, $dataBase;
		protected $pdo;
		
		$maBD = 
		
		public function __construct(){
			$this->serveur = "localhost";
			$this->user = "root";
			$this->motDePass = "";
			$this->dataBase = "bdecoleok";
			$this->pdo = new PDO('mysql:host='.$this->serveur.';dbname='.$this->dataBase, $this->user, $this->motDePass);
		}
		
		public function toString(){
			return $this->dataBase.'  '.$this->serveur;
		}
		
		function connect_db(){
		try{
			$bd = new PDO('mysql:host=localhost;dbname=bdecoleok','root','');
		}
		catch(PDOException $e){
			echo "Impossible de se connecter !";
		}
		return $bd;
	}
		 
		
	}*/
	
?>
