浏览代码

Add ORDER BY to tables

Foppe Hemminga 6 年之前
父节点
当前提交
674e5c0a52
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      index.php

+ 3 - 2
index.php

@@ -44,7 +44,8 @@
 		print "</pre>";
 */
         $query = sprintf("SELECT * FROM race_program  
-            WHERE race_date >= %s AND torn = TRUE;", $conn->quote($date->format('Y-m-d')));
+            WHERE race_date >= %s AND torn = TRUE
+            ORDER BY race_date, venue, race DESC;", $conn->quote($date->format('Y-m-d')));
         $stmt2 = $conn->query( $query );
         ?>
         <table class="table table-striped table-bordered">
@@ -76,7 +77,7 @@
         </table>
         <?php
         $query = sprintf("SELECT * FROM race_program
-        WHERE race_date >= %s;", $conn->quote($date->format('Y-m-d')));
+        WHERE race_date >= %s ORDER BY race_date, venue, race DESC;", $conn->quote($date->format('Y-m-d')));
         $stmt3 = $conn->query( $query );
         ?>
         <table class="table table-striped table-bordered">