public static function selectObject($selectString, $whereArray = null, $afterWhere = '') { $db = new Database(); $db->connect(); $whereString = ''; if ($whereArray != null) { foreach ($whereArray as $key => $value) { if ($whereString == "") { $whereString = $whereString . " " . $key . "='" . $value . "' "; } else { $whereString = $whereString . " and " . $key . "='" . $value . "' "; } } if ($whereString != '') { $whereString = ' where ' . $whereString; } } $queryString = "select {$selectString} from " . Table::$tableName . $whereString . " " . $afterWhere; $sql = $db->objectQuery($queryString); return $sql; }