From 0e3cbe2876d94ee77a63a0615b54030c3e8cb836 Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Fri, 29 Dec 2017 03:45:42 +0000 Subject: [PATCH] Fix INSERTS with Selects inside --- include/classes/mysqlims.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/classes/mysqlims.class.php b/include/classes/mysqlims.class.php index 98ec503e..32ec2c61 100644 --- a/include/classes/mysqlims.class.php +++ b/include/classes/mysqlims.class.php @@ -61,7 +61,7 @@ class mysqlims extends mysqli */ public function prepare($query) { - if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->slave !== false) { + if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && stripos($query, "INSERT") === false && $this->slave !== false) { $this->lastused = $this->mysqliR; return $this->mysqliR->prepare($query); } else { @@ -80,7 +80,7 @@ class mysqlims extends mysqli */ public function query($query, $resultmode = MYSQLI_STORE_RESULT) { - if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->slave !== false) {/* Use readonly server */ + if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && stripos($query, "INSERT") === false && $this->slave !== false) {/* Use readonly server */ $this->lastused = $this->mysqliR; return $this->mysqliR->query($query, $resultmode); } else { @@ -88,4 +88,4 @@ class mysqlims extends mysqli return $this->mysqliW->query($query, $resultmode); } } -} \ No newline at end of file +}