$pts_sql = sprintf("SELECT p.pts AS pts, g.mult AS mult
FROM %sbin5_points as p, %sbin5_games as g
WHERE p.gcode = g.code AND g.mcode = %d AND p.ucode = %d
- ORDER BY g.code ASC
+ ORDER BY g.tstamp ASC
LIMIT %d OFFSET %d;",
$G_dbpfx, $G_dbpfx, $match_code, $user['code'],
MAX_POINTS,
$u++;
}
- $gam_sql = sprintf("SELECT * FROM %sbin5_games WHERE mcode = %d ORDER BY code DESC LIMIT 1;", $G_dbpfx, $match_code);
+ $gam_sql = sprintf("SELECT * FROM %sbin5_games WHERE mcode = %d ORDER BY tstamp DESC LIMIT 1;", $G_dbpfx, $match_code);
if (($gam_pg = $this->query($gam_sql)) == FALSE || pg_numrows($gam_pg) != 1) {
log_crit(sprintf("%s::%s: get last game fails", __CLASS__, __FUNCTION__));
return (FALSE);
SELECT p.pts AS pts
FROM %sbin5_games AS g, %sbin5_points AS p
WHERE g.code = p.gcode AND g.mcode = %d AND p.ucode = %d
- ORDER BY g.code",
+ ORDER BY g.tstamp",
$G_dbpfx, $G_dbpfx,
$tmt_obj->code, $users[$u]['code']);