mysqli error handling

This commit is contained in:
Steffen Schröder 2014-03-19 11:36:57 +01:00
parent effc3c500c
commit 1386e00ce3

View File

@ -357,14 +357,18 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
$mysqli = $this->maniaControl->database->mysqli;
$result = $mysqli->query('SELECT * FROM ' . self::TABLE_RANK . ' WHERE PlayerIndex=' . $player->index);
if ($result->num_rows > 0) {
$row = $result->fetch_array();
$result->free_result();
return Rank::fromArray($row);
} else {
if ($mysqli->error) {
trigger_error($mysqli->error);
return null;
}
if ($result->num_rows <= 0) {
$result->free_result();
return null;
}
$row = $result->fetch_array();
$result->free_result();
return Rank::fromArray($row);
}
/**