# HG changeset patch # User Matti Hamalainen # Date 1557999744 -10800 # Node ID 0b0094db56da467e83e5c3784dfd4c2dbb20d07f # Parent 0a2117349f463522c39360c8e2e4ec87fb2de2a2 Improve function stDBPrepareSQLUpdate() by adding new optional last argument to specify values array. diff -r 0a2117349f46 -r 0b0094db56da msitegen.inc.php --- a/msitegen.inc.php Tue May 14 14:45:36 2019 +0300 +++ b/msitegen.inc.php Thu May 16 12:42:24 2019 +0300 @@ -579,12 +579,13 @@ } -function stDBPrepareSQLUpdate($dbh, $table, $cond, $pairs) +function stDBPrepareSQLUpdate($dbh, $table, $cond, $pairs, $values = NULL) { - $sql = array(); + $sql = []; foreach ($pairs as $name => $attr) { - $sql[] = $name."=".stDBGetSQLParam($dbh, $attr, $name); + $sql[] = $name."=".stDBGetSQLParam($dbh, + $attr, $values !== NULL ? $values[$name] : $name); } return "UPDATE ".$table." SET ".implode(",", $sql).