From af9fe9ab6d4ba9083586e105963c91a419e37b42 Mon Sep 17 00:00:00 2001 From: kaysen Date: Mon, 7 Nov 2016 15:51:37 +0800 Subject: [PATCH 1/4] FIX: update and delete --- class.MySQL.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/class.MySQL.php b/class.MySQL.php index effe482..0f977bf 100644 --- a/class.MySQL.php +++ b/class.MySQL.php @@ -261,7 +261,13 @@ public function delete($table, $where='', $limit='', $like=false, $wheretypes=ar $query .= ' LIMIT ' . $limit; } - return $this->executeSQL($query); + $result = $this->executeSQL($query); + + if((int) @mysql_affected_rows($this->databaseLink) == 0){ + return false; + } + + return $result; } @@ -344,7 +350,13 @@ public function update($table, $set, $where, $exclude = '', $datatypes=array(), $query = substr($query, 0, -5); - return $this->executeSQL($query); + $result = $this->executeSQL($query); + + if((int) @mysql_affected_rows($this->databaseLink) == 0){ + return false; + } + + return $result; } // 'Arrays' a single result From 763ae064622c44fe12ae069c7eec4f8ac9822058 Mon Sep 17 00:00:00 2001 From: kaysen Date: Mon, 7 Nov 2016 16:45:21 +0800 Subject: [PATCH 2/4] MOD: class.MySQL.php --- test.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test.php diff --git a/test.php b/test.php new file mode 100644 index 0000000..a4e4801 --- /dev/null +++ b/test.php @@ -0,0 +1,18 @@ +'kaysen', 'age'=>27, 'created'=>time()); +$status = $DB->insert('kaysen_tab', $insertData); +var_dump($status); + */ + +/* +$status = $DB->update('kaysen_tab', array('age'=>666), array('id'=>1)); +var_dump($status); + */ + +$status = $DB->delete('kaysen_tab', array('id'=>1)); +var_dump($status); From 5ccb5210e6bccfe5f5077438a33fb224c5916424 Mon Sep 17 00:00:00 2001 From: kaysen Date: Mon, 7 Nov 2016 16:49:43 +0800 Subject: [PATCH 3/4] Revert "MOD: class.MySQL.php" This reverts commit 763ae064622c44fe12ae069c7eec4f8ac9822058. --- test.php | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 test.php diff --git a/test.php b/test.php deleted file mode 100644 index a4e4801..0000000 --- a/test.php +++ /dev/null @@ -1,18 +0,0 @@ -'kaysen', 'age'=>27, 'created'=>time()); -$status = $DB->insert('kaysen_tab', $insertData); -var_dump($status); - */ - -/* -$status = $DB->update('kaysen_tab', array('age'=>666), array('id'=>1)); -var_dump($status); - */ - -$status = $DB->delete('kaysen_tab', array('id'=>1)); -var_dump($status); From 2e213511ece132429bae95fa1261dc26087173f5 Mon Sep 17 00:00:00 2001 From: kaysen Date: Mon, 7 Nov 2016 16:50:34 +0800 Subject: [PATCH 4/4] MOD: class.MySQL.php --- class.MySQL.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/class.MySQL.php b/class.MySQL.php index 0f977bf..3429fcd 100644 --- a/class.MySQL.php +++ b/class.MySQL.php @@ -263,7 +263,7 @@ public function delete($table, $where='', $limit='', $like=false, $wheretypes=ar $result = $this->executeSQL($query); - if((int) @mysql_affected_rows($this->databaseLink) == 0){ + if($this->affected == 0){ return false; } @@ -352,7 +352,7 @@ public function update($table, $set, $where, $exclude = '', $datatypes=array(), $result = $this->executeSQL($query); - if((int) @mysql_affected_rows($this->databaseLink) == 0){ + if($this->affected == 0){ return false; }