Commit af6a96aa by Scott

Fix query parameters in qa_db_points_update_ifuser

parent 57e9e996
...@@ -188,6 +188,7 @@ function qa_db_points_update_ifuser($userid, $columns) ...@@ -188,6 +188,7 @@ function qa_db_points_update_ifuser($userid, $columns)
$insertfields = 'userid, '; $insertfields = 'userid, ';
$insertvalues = '?, '; $insertvalues = '?, ';
$insertparams = [$userid];
$insertpoints = (int)qa_opt('points_base'); $insertpoints = (int)qa_opt('points_base');
$updates = ''; $updates = '';
...@@ -199,6 +200,7 @@ function qa_db_points_update_ifuser($userid, $columns) ...@@ -199,6 +200,7 @@ function qa_db_points_update_ifuser($userid, $columns)
if (isset($keycolumns[$field])) { if (isset($keycolumns[$field])) {
$insertfields .= $field . ', '; $insertfields .= $field . ', ';
$insertvalues .= '@_' . $field . ':=(SELECT ' . $calculation['formula'] . '), '; $insertvalues .= '@_' . $field . ':=(SELECT ' . $calculation['formula'] . '), ';
$insertparams[] = $userid;
$updates .= $field . '=@_' . $field . ', '; $updates .= $field . '=@_' . $field . ', ';
$insertpoints .= '+(' . (int)$multiple . '*@_' . $field . ')'; $insertpoints .= '+(' . (int)$multiple . '*@_' . $field . ')';
} }
...@@ -209,7 +211,7 @@ function qa_db_points_update_ifuser($userid, $columns) ...@@ -209,7 +211,7 @@ function qa_db_points_update_ifuser($userid, $columns)
$query = 'INSERT INTO ^userpoints (' . $insertfields . 'points) VALUES (' . $insertvalues . $insertpoints . ') ' . $query = 'INSERT INTO ^userpoints (' . $insertfields . 'points) VALUES (' . $insertvalues . $insertpoints . ') ' .
'ON DUPLICATE KEY UPDATE ' . $updates . 'points=' . $updatepoints . '+bonus'; 'ON DUPLICATE KEY UPDATE ' . $updates . 'points=' . $updatepoints . '+bonus';
$result = $db->query($query, array($userid, $userid)); $result = $db->query($query, $insertparams);
if ($result->affectedRows() > 0) { if ($result->affectedRows() > 0) {
qa_db_userpointscount_update(); qa_db_userpointscount_update();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment