/** * Returns the SQL results * * @version 1 * @author Rick de Man <*****@*****.**> * * @param bool $Fetchall * Override Single result to Fetchall * @return integer|false|array * */ private function Result($Fetchall = false) { // Detect mysql 'USE' if (preg_match('/^USE/i', $this->Log['Q']) !== 0) { // Return true: Connected return true; } // Detect mysql INSERT, UPDATE or DELETE if (preg_match('/^(UPDATE|INSERT INTO|DELETE)/i', $this->Log['Q']) !== 0) { // Return affected rows return $this->STH->RowCount(); } // Fetch all rows guaranteed $STH = $this->STH->Fetchall(); // Count the Rows $Count = count($STH); // Return the Results of the Query if ($Count == 0) { // Return false, nothing is found return false; } else { if ($Count == 1 && $Fetchall === false) { // Return (multi-dimension) Array return $STH[0]; } else { // Return Multi-array ( All results ) return $STH; } } }