Kaynağa Gözat

Add race time to table

Foppe Hemminga 6 yıl önce
ebeveyn
işleme
f3edc53572
1 değiştirilmiş dosya ile 9 ekleme ve 3 silme
  1. 9 3
      index.php

+ 9 - 3
index.php

@@ -25,12 +25,16 @@
 			echo "Connected to the <strong>$db</strong> database successfully!";
 		}
 
-		$query = sprintf("SELECT * FROM horses 
-            WHERE race_date >= %s
+		$query = sprintf("SELECT FROM horses JOIN race_program
+            ON horses.race_date = race_program.race_date
+                AND horses.venue = race_program.venue
+            WHERE horses.race_date >= %s
             ORDER BY race_date, venue, race;", $conn->quote(date("Y-m-d")));
 		$stmt = $conn->query($query);
 		// $r = $stmt->fetch(PDO::FETCH_ASSOC);
-echo '    <table class="table table-striped table-bordered">';
+        ?>
+<table class="table table-striped table-bordered">
+    <?php
     $table_head = <<<TABLEHEAD
         <thead>
         <tr>
@@ -38,6 +42,7 @@ echo '    <table class="table table-striped table-bordered">';
             <th>venue</th>
             <th>race_date</th>
             <th>race</th>
+            <th>start</th>
             <th>horse</th>
         </tr>
         </thead>
@@ -78,6 +83,7 @@ TABLEFOOT;
         <td><?php echo htmlspecialchars($row['venue']); ?></td>
         <td><?php echo htmlspecialchars($row['race_date']); ?></td>
         <td><?php echo htmlspecialchars($row['race']); ?></td>
+        <td><?php echo htmlspecialchars($row['start_time']); ?></td>
         <td><?php echo htmlspecialchars($row['horse']); ?></td>
     </tr>
 	<?php endwhile; ?>