HTML table using MySQLi and PHP -
i'm trying make table connected database can use information in database.
i think i'm on right way, table displays first row. got ideas on what's going on?
<table id="fairtable"> <tr> <td>fair name</td> <td>date</td> <td>are there?</td> <td>website</td> </tr> <?php $sql = "select `name`,`date`,`present`,`website` `dates`"; $results = mysqli_query($conn,$sql); while($rowitem = mysqli_fetch_array($results)) { echo "<tr>"; echo "<td>" . $rowitem['name'] . "</td>"; echo "<td>" . $rowitem['date'] . "</td>"; echo "<td>" . $rowitem['present'] . "</td>"; echo "<td>" . $rowitem['website'] . "</td>"; echo "</tr>"; } ?> </table>
perhaps because have not opened html table tags correctly, easy thing overlook. loop result set inside white statement:
$sql = "select `name`,`date`,`present`,`website` `dates`"; $results = mysqli_query($conn,$sql); echo "<table>"; //begin table tag... //you can add thead tag here if want table have column headers while($rowitem = mysqli_fetch_array($results)) { echo "<tr>"; echo "<td>" . $rowitem['name'] . "</td>"; echo "<td>" . $rowitem['date'] . "</td>"; echo "<td>" . $rowitem['present'] . "</td>"; echo "<td>" . $rowitem['website'] . "</td>";*/ echo "</tr>"; } echo "</table>"; //end table tag
Comments
Post a Comment