So I am able to extract data from MYSQL and iterate through it and populate a <table>
using html tags to render in the browser. I also have a separate CSS file that will style the <table>
for me.
My question is, does the rest of the webpage that contains the table have to be constructed from the same PHP file and/or with PHP? Please can someone advise?
My code thus far populating the table and creating the webpage is as such:
// Creating and populating table for 'filename' and 'title'.
echo '<link rel="stylesheet" type="text/css" href="css/main.css"/>';
echo '<table>';
echo "<tr><td class='tableHeader' colspan=2>List of Articles</td></tr>";
echo '<tr> <th>Filename</th> <th>Title</th> </tr>';
while($row = $result -> fetch_assoc()){
// Fetch result row as an associative array or NULL if there are no more rows.
$filename = $row['filename'];
$title = $row['title'];
echo "<tr> <td class='filename'>".$filename."</td> <td class='title'>".$title."</td></tr>";
}//end of while loop
echo '</table>';