fix SQL query
This commit is contained in:
parent
f359fe1ba9
commit
70db771f9b
@ -32,7 +32,7 @@ class ClimbTheMap implements ManialinkPageAnswerListener, TimerListener, Command
|
|||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
const PLUGIN_ID = 192;
|
const PLUGIN_ID = 192;
|
||||||
const PLUGIN_VERSION = 1.1;
|
const PLUGIN_VERSION = 1.2;
|
||||||
const PLUGIN_NAME = 'ClimbTheMap';
|
const PLUGIN_NAME = 'ClimbTheMap';
|
||||||
const PLUGIN_AUTHOR = 'Beu';
|
const PLUGIN_AUTHOR = 'Beu';
|
||||||
|
|
||||||
@ -309,16 +309,16 @@ class ClimbTheMap implements ManialinkPageAnswerListener, TimerListener, Command
|
|||||||
|
|
||||||
$mysqli = $this->maniaControl->getDatabase()->getMysqli();
|
$mysqli = $this->maniaControl->getDatabase()->getMysqli();
|
||||||
|
|
||||||
$stmt = $mysqli->prepare('SELECT ctm.index,ctm.login,p.nickname,ctm.altitude,ctm.time,ctm.date FROM `' . self::DB_CLIMBTHEMAP . '` ctm
|
$query = 'SELECT ctm.index,ctm.login,p.nickname,ctm.altitude,ctm.time,ctm.date FROM `' . self::DB_CLIMBTHEMAP . '` ctm
|
||||||
LEFT JOIN `' . PlayerManager::TABLE_PLAYERS . '` p
|
LEFT JOIN `' . PlayerManager::TABLE_PLAYERS . '` p
|
||||||
ON ctm.login = p.login
|
ON ctm.login = p.login
|
||||||
WHERE `mapIndex` = ?
|
WHERE `mapIndex` = ?
|
||||||
ORDER BY
|
ORDER BY (CASE WHEN `time` > 0 THEN `time` ELSE 9999999999 END) ASC,
|
||||||
CASE
|
`altitude` DESC,
|
||||||
WHEN `time` > 0 THEN `time`
|
`date` ASC';
|
||||||
ELSE `altitude`
|
var_dump($query);
|
||||||
END DESC,
|
|
||||||
`date` ASC');
|
$stmt = $mysqli->prepare($query );
|
||||||
$stmt->bind_param('i', $mapIndex);
|
$stmt->bind_param('i', $mapIndex);
|
||||||
if (!$stmt->execute()) {
|
if (!$stmt->execute()) {
|
||||||
trigger_error('Error executing MySQL query: ' . $stmt->error);
|
trigger_error('Error executing MySQL query: ' . $stmt->error);
|
||||||
|
Loading…
Reference in New Issue
Block a user