Skip to content

Instantly share code, notes, and snippets.

@tuxis-ie
Created August 26, 2015 13:09
Show Gist options
  • Save tuxis-ie/e079a216b63d5e0300c3 to your computer and use it in GitHub Desktop.
Save tuxis-ie/e079a216b63d5e0300c3 to your computer and use it in GitHub Desktop.
diff --git a/includes/dbFacile.mysqli.php b/includes/dbFacile.mysqli.php
index 2408ca9..1cc3492 100644
--- a/includes/dbFacile.mysqli.php
+++ b/includes/dbFacile.mysqli.php
@@ -65,7 +65,7 @@ function dbQuery($sql, $parameters=array()) {
* */
-function dbInsert($data, $table) {
+function dbInsert($data, $table, $replace = false) {
global $fullSql, $database_link;
global $db_stats;
// the following block swaps the parameters if they were given in the wrong order.
@@ -79,7 +79,8 @@ function dbInsert($data, $table) {
// trigger_error('QDB - Parameters passed to insert() were in reverse order, but it has been allowed', E_USER_NOTICE);
}
- $sql = 'INSERT INTO `'.$table.'` (`'.implode('`,`', array_keys($data)).'`) VALUES ('.implode(',', dbPlaceHolders($data)).')';
+ $cmd = ($replace === true ? 'REPLACE' : 'INSERT');
+ $sql = $cmd.' INTO `'.$table.'` (`'.implode('`,`', array_keys($data)).'`) VALUES ('.implode(',', dbPlaceHolders($data)).')';
$time_start = microtime(true);
dbBeginTransaction();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment