Skip to content

Commit 204358d

Browse files
committed
fix $affected while querying an UPDATE
According to http://php.net/mysql_query For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or FALSE on error. For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysql_query() returns TRUE on success or FALSE on error.
1 parent 0531717 commit 204358d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

class.MySQL.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,10 @@ public function executeSQL($query){
172172
if($this->result = mysql_query($query, $this->databaseLink)){
173173
if (gettype($this->result) === 'resource') {
174174
$this->records = @mysql_num_rows($this->result);
175-
$this->affected = @mysql_affected_rows($this->databaseLink);
176175
} else {
177176
$this->records = 0;
178-
$this->affected = 0;
179177
}
178+
$this->affected = @mysql_affected_rows($this->databaseLink);
180179

181180
if($this->records > 0){
182181
$this->arrayResults();
@@ -375,4 +374,4 @@ public function closeConnection(){
375374
mysql_close($this->databaseLink);
376375
}
377376
}
378-
}
377+
}

0 commit comments

Comments
 (0)