Section 2 finished.

This commit is contained in:
Patryk Hegenberg 2022-12-14 08:31:40 +01:00
parent 13490cdad2
commit c96119c47f
2 changed files with 12 additions and 4 deletions

View file

@ -8,9 +8,9 @@ class Database {
$dsn = 'mysql:'.http_build_query($config, '', ';');
$this->connection = new PDO($dsn, $username, $password, [PDO::ATTR_DEFAULT_FETCH_MODE=> PDO::FETCH_ASSOC]);
}
public function query($query) {
public function query($query, $params = []) {
$statement = $this->connection->prepare($query);
$statement->execute();
$statement->execute($params);
return $statement;
}
}