mirror of https://github.com/myphpfw/database.git
conditional parameter (nullable)
This commit is contained in:
parent
ba4f3a6158
commit
e9863f966a
|
@ -20,12 +20,14 @@
|
|||
}
|
||||
}
|
||||
|
||||
public function bind_and_execute(array $parameters = []) {
|
||||
public function bind_and_execute(?array $parameters = []) {
|
||||
if(isset($parameters)) {
|
||||
foreach($parameters as $key => $val) {
|
||||
if ($this->statement->bindValue($key, $val) === FALSE) {
|
||||
die("Binding parameters failed: ".$this->statement->errorInfo()[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if($this->statement->execute() === FALSE) {
|
||||
die("Execute failed: ".$this->statement->errorInfo()[2]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue