"Fix'd" the execute query to pass args array without binding, assuming the first value is at index 0 and the query uses questionmarks.
This commit is contained in:
parent
065102016a
commit
3d66c7ce41
@ -325,15 +325,20 @@ class Database {
|
||||
public function execute($query, $args=array()) {
|
||||
try {
|
||||
$stmt = $this->db->prepare($query);
|
||||
foreach($args as $name=>$value) {
|
||||
if(is_numeric($value)) {
|
||||
$stmt->bindValue(":$name", $value, PDO::PARAM_INT);
|
||||
}
|
||||
else {
|
||||
$stmt->bindValue(":$name", $value, PDO::PARAM_STR);
|
||||
if (!array_key_exists(0, $args)) {
|
||||
foreach($args as $name=>$value) {
|
||||
if(is_numeric($value)) {
|
||||
$stmt->bindValue(":$name", $value, PDO::PARAM_INT);
|
||||
}
|
||||
else {
|
||||
$stmt->bindValue(":$name", $value, PDO::PARAM_STR);
|
||||
}
|
||||
}
|
||||
$stmt->execute();
|
||||
}
|
||||
else {
|
||||
$stmt->execute($args);
|
||||
}
|
||||
$stmt->execute();
|
||||
return $stmt;
|
||||
}
|
||||
catch(PDOException $pdoe) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user