|  | @@ -0,0 +1,35 @@
 | 
	
		
			
			|  | 1 | +<?php 
 | 
	
		
			
			|  | 2 | +
 | 
	
		
			
			|  | 3 | +class Connector() {
 | 
	
		
			
			|  | 4 | +
 | 
	
		
			
			|  | 5 | +	private $bdd;
 | 
	
		
			
			|  | 6 | +	
 | 
	
		
			
			|  | 7 | +	function __construct() {
 | 
	
		
			
			|  | 8 | +		$host = "localhost";
 | 
	
		
			
			|  | 9 | +		$db = "burgerquizz";
 | 
	
		
			
			|  | 10 | +		$user = "alain";
 | 
	
		
			
			|  | 11 | +		$pass = "chabat";
 | 
	
		
			
			|  | 12 | +
 | 
	
		
			
			|  | 13 | +		$this->bdd = new PDO("mysql:host=$host;dbname=$db", $user, $pass);
 | 
	
		
			
			|  | 14 | +	}
 | 
	
		
			
			|  | 15 | +
 | 
	
		
			
			|  | 16 | +	/*
 | 
	
		
			
			|  | 17 | +		Exemple de $options :
 | 
	
		
			
			|  | 18 | +
 | 
	
		
			
			|  | 19 | +		$options = array(
 | 
	
		
			
			|  | 20 | +			"where" => array(
 | 
	
		
			
			|  | 21 | +				array("foo", "=", "bar"),
 | 
	
		
			
			|  | 22 | +				array("blbl", ">", 5)
 | 
	
		
			
			|  | 23 | +			);
 | 
	
		
			
			|  | 24 | +			"order by" => array(0, 10, "desc");
 | 
	
		
			
			|  | 25 | +		);
 | 
	
		
			
			|  | 26 | +	*/
 | 
	
		
			
			|  | 27 | +	function Select($fields, $table, $options) {
 | 
	
		
			
			|  | 28 | +		$request = "SELECT $fields FROM $table ";
 | 
	
		
			
			|  | 29 | +		$arrayVerif = array();
 | 
	
		
			
			|  | 30 | +		foreach($options as $name=>$value) {
 | 
	
		
			
			|  | 31 | +/*			$request += " $name :$name";
 | 
	
		
			
			|  | 32 | +			$arrayVerif[":$name"] = $value;*/
 | 
	
		
			
			|  | 33 | +		}
 | 
	
		
			
			|  | 34 | +	}
 | 
	
		
			
			|  | 35 | +}
 |