2

I have created a table on my website populated by database entries using php. What I want to do for aesthetic purposes is to have every second row to be empty and have a gap between each row. The below is my code so far.

    $sql = "SELECT id, tablename, numseats, person FROM confirms";
            $result = $conn->query($sql);
            ?>

            <table id="Confirms" border ="2" style="length:900px;width:350px;">
                  <thead>
                    <tr style= "background-color: #A4A4A4;">
                      <td>Booking ID:</td>
                      <td>Table No.:</td>
                      <td>No. of Seats:</td>
                      <td>Person:</td>
                    </tr>
                  </thead>
                <tbody>
                    <?php
                      while( $row = $result->fetch_assoc()){
                        echo
                        "<tr>
                          <td>{$row['id']}</td>
                          <td>{$row['tablename']}</td>
                          <td>{$row['numseats']}</td>
                          <td>{$row['person']}</td>
                        </tr>\n";
                      }
                    ?>
                </tbody>
            </table>

Everything is functioning correctly at the moment and there is no php problem. It's just purely an appearance question. Thanks.

Matt Cremeens
  • 4,951
  • 7
  • 38
  • 67
dhool
  • 291
  • 1
  • 3
  • 14
  • Possible duplicate of [Space between two rows in a table?](http://stackoverflow.com/questions/351058/space-between-two-rows-in-a-table) – Mihai Matei Feb 26 '16 at 12:26

1 Answers1

4

Try this loop,

             <?php
                  while( $row = $result->fetch_assoc()){
                    echo
                    "<tr>
                      <td>{$row['id']}</td>
                      <td>{$row['tablename']}</td>
                      <td>{$row['numseats']}</td>
                      <td>{$row['person']}</td>
                    </tr><tr>
                      <td></td>
                      <td></td>
                      <td></td>
                      <td></td>
                    </tr>\n";
                  }
                ?>
Vinod VT
  • 6,946
  • 11
  • 51
  • 75
  • I will not down vote just because dhool explicitly requested such solution.. I voted the question as duplicate because there are many other solutions better than this one.. http://stackoverflow.com/questions/351058/space-between-two-rows-in-a-table – Mihai Matei Feb 26 '16 at 12:28