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