Fix bind parameters mapping

This commit is contained in:
Bartek Fabiszewski 2017-05-23 10:01:21 +02:00
parent 3c0f023121
commit 090c86a62a

View File

@ -266,10 +266,11 @@
private function loadWithQuery($query, $bindParams = NULL) { private function loadWithQuery($query, $bindParams = NULL) {
$stmt = self::$db->prepare($query); $stmt = self::$db->prepare($query);
if (is_array($bindParams)) { if (is_array($bindParams)) {
foreach ($bindParams as $key => &$value) { $params = [];
$bindParams[$key] = $value; foreach ($bindParams as &$value) {
$params[] =& $value;
} }
call_user_func_array([ $stmt, 'bind_param' ], $bindParams); call_user_func_array([ $stmt, 'bind_param' ], $params);
} }
if ($stmt->execute()) { if ($stmt->execute()) {
$stmt->bind_result($this->id, $this->timestamp, $this->userId, $this->trackId, $stmt->bind_result($this->id, $this->timestamp, $this->userId, $this->trackId,