Foppe Hemminga пре 6 година
родитељ
комит
4071051224
1 измењених фајлова са 6 додато и 5 уклоњено
  1. 6 5
      index.php

+ 6 - 5
index.php

@@ -30,9 +30,8 @@
             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_head = <<<TABLEHEAD
-    <table class="table table-striped table-bordered">
         <thead>
         <tr>
             <th>id</th>
@@ -46,25 +45,26 @@
 TABLEHEAD;
 	$table_foot = <<<TABLEFOOT
         </tbody>
-    </table>
 TABLEFOOT;
     echo( $table_head );
     $new_venue = '';
     $new_day = '';
+    $head_displayed = False;
     while($row = $stmt->fetch(PDO::FETCH_ASSOC)) : ?>
         <?php
             if ( $new_day != '' ) {
-				if ($new_day != $row['race_date']) {
+				if ( $new_day != $row['race_date'] ) {
 					echo $table_foot;
 					echo '<h4>' . htmlspecialchars($row['race_date']) . '</h4>';
 					echo $table_head;
 					$new_day = $row['race_date'];
+					$head_displayed = True;
 				}
 			} else {
 				$new_day = $row['race_date'];
             }
             if ( $new_venue != '' ) {
-                if ($new_venue != $row['venue'] ) {
+                if ( $new_venue != $row['venue'] ) {
 					echo $table_foot;
 					echo $table_head;
 					$new_venue = $row['venue'];
@@ -81,6 +81,7 @@ TABLEFOOT;
         <td><?php echo htmlspecialchars($row['horse']); ?></td>
     </tr>
 	<?php endwhile; ?>
+</table>
     <?php
     echo $table_foot;