Czesc. Mam taka prosta klase/zbior funkcji.. wykonujace proste zapytania do bazy i mierzace czas metoda microtime. Zmienna result zwraca nieraz ujemny wynik, dlaczego tak ? (funkja handler) class testDatabase_Model{ private $db; private $db_type; private $names; private $starttime; private $endtime; private $result; private $sql; public function PDO_Connection() { $this->db = PDO_Database::GetInstance(); $this->db_type = 'PDO'; } public function MySQLi_Connection() { $this->db = Mysql_Database::GetInstance(); $this->db_type = 'MySQLi'; } public function getStarttime() {return $this->starttime;} public function getEndtime() return $this->endtime;} public function getResult() {return $this->result;} public function getDb_type() {return $this->db_type; } public function ExecuteQuery($sql) { if($this->db_type == "MySQLi") { if(! mysqli_query($this->db,$sql)) { } } if($this->db_type == "PDO") { try{ $this->db->query($sql); }catch (Exception $e) { } } } public function insert() { $sql = "INSERT INTO speed_test VALUES"; for ($i = 0; $i< 10000; $i ++) { $name = $this->getRandomName(); $date = $this->getRandomDate(); $age = $this->getRandomAge(); $sql .= " ('' , '$name' ,'$date' , '$age' ) ,"; } $sql .= "('' , '' , '' , '' ) "; $this->sql = $sql; $this->handler(); } public function select() { $this->sql = "SELECT * FROM speed_test"; $this->handler(); } public function update() { $this->sql = "UPDATE speed_test set name='Stefan', age=99"; $this->handler(); } public function handler() { $this->ExecuteQuery($this->sql); } }