Пример #1
0
 private static function init($host, $db, $user, $password)
 {
     try {
         self::$connexion = new \PDO('mysql:host=' . $host . ';dbname=' . $db . ';charset=UTF8;', $user, $password);
         self::$connexion->query("SET NAMES utf8;");
         self::$connexion->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
     } catch (Exception $e) {
         echo 'Echec de la connexion : ' . $e->getMessage();
     }
 }
Пример #2
0
 public function testSportid()
 {
     $Query = new ModelQuery();
     $Query->setSportid(1);
     $Query->execute($this->DB);
     $this->assertEquals(array(-10 => 150, -1 => 30, 0 => 100), $Query->data());
     $Query->setSportid(2);
     $Query->execute($this->DB);
     $this->assertEquals(array(-3 => 70, -1 => 20), $Query->data());
 }