Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0531717

Browse files
Merge pull request #43 from argosback/master
query 'SET NAMES utf8' error: mysql_num_rows() expects parameter 1 to be...
2 parents a6f82a8 + 3c6fe9d commit 0531717

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

‎class.MySQL.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,15 @@ private function CleanData($data, $type = ''){
168168

169169
// Executes MySQL query
170170
public function executeSQL($query){
171-
$this->lastQuery = $query;
172-
if($this->result = mysql_query($query, $this->databaseLink)){
173-
$this->records = @mysql_num_rows($this->result);
174-
$this->affected = @mysql_affected_rows($this->databaseLink);
171+
$this->lastQuery = $query;
172+
if($this->result = mysql_query($query, $this->databaseLink)){
173+
if (gettype($this->result) === 'resource') {
174+
$this->records = @mysql_num_rows($this->result);
175+
$this->affected = @mysql_affected_rows($this->databaseLink);
176+
} else {
177+
$this->records = 0;
178+
$this->affected = 0;
179+
}
175180

176181
if($this->records > 0){
177182
$this->arrayResults();

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /