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 3c6fe9d

Browse files
query 'SET NAMES utf8' error: mysql_num_rows() expects parameter 1 to be resource
1 parent a6f82a8 commit 3c6fe9d

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 によって変換されたページ (->オリジナル) /