diff options
Diffstat (limited to 'phpBB/includes/db/mysqli.php')
-rw-r--r-- | phpBB/includes/db/mysqli.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/phpBB/includes/db/mysqli.php b/phpBB/includes/db/mysqli.php index ffe39d63bf..48ea8d3c53 100644 --- a/phpBB/includes/db/mysqli.php +++ b/phpBB/includes/db/mysqli.php @@ -269,6 +269,41 @@ class dbal_mysqli extends dbal } } + function sql_handle_data($type, $table, $data, $where = '') + { + if ($type === 'INSERT') + { + $stmt = mysqli_prepare($this->db_connect_id, "INSERT INTO $table (". implode(', ', array_keys($data)) . ") VALUES (" . substr(str_repeat('?, ', sizeof($data)) ,0, -1) . ')'); + } + else + { + $query = "UPDATE $table SET "; + + $set = array(); + foreach (array_keys($data) as $key) + { + $set[] = "$key = ?"; + } + $query .= implode(', ', $set); + + if ($where !== '') + { + $query .= $where; + } + + $stmt = mysqli_prepare($this->db_connect_id, $query); + } + + // get the stmt onto the top of the function arguments + array_unshift($data, $stmt); + + call_user_func_array('mysqli_stmt_bind_param', $data); + mysqli_stmt_execute($stmt); + + mysqli_stmt_close($stmt); + } + + /** * Build LIKE expression * @access private |