X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2FObj%2Fdbase_pgsql.phh;h=5f0511edcffc45f6664ca31bfd56111275effe5d;hb=f3852bd3b377919fdbb3e6a3a351a0ce62f30bac;hp=9a0baa317cda5c1aed4e64310a2c0b2a13000634;hpb=b0f28087d9a3d6e59e7e658f163d26958aa9d30d;p=brisk.git diff --git a/web/Obj/dbase_pgsql.phh b/web/Obj/dbase_pgsql.phh index 9a0baa3..5f0511e 100644 --- a/web/Obj/dbase_pgsql.phh +++ b/web/Obj/dbase_pgsql.phh @@ -435,7 +435,7 @@ class BriskDB $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, @@ -463,7 +463,7 @@ class BriskDB $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);