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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -