Rewrite the title as: Display the data in the MySQL database table as an HTML table on the web page
P粉764836448
2023-08-20 14:48:09
<p>I want to retrieve values from a database table and display them in a page as an html table.
I've searched but can't find the answer, although it's certainly an easy thing to do (it should be database basics haha). I guess the terms I searched for might be misleading.
The name of the database table is tickets, it now has 6 fields (submission_id, formID, IP, name, email and message), but there should be another field called ticket_number.
How can I make it display all the values from the database in the form of the following html table: </p>
<pre class="brush:php;toolbar:false;"><table border="1">
<tr>
<th>Submission ID</th>
<th>Form ID</th>
<th>IP</th>
<th>Name</th>
<th>E-mail</th>
<th>Message</th>
</tr>
<tr>
<td>123456789</td>
<td>12345</td>
<td>123.555.789</td>
<td>John Johnny</td>
<td>johnny@example.com</td>
<td>This is the message John sent you</td>
</tr>
</table></pre>
<p>Then display all other values below 'john'. </p>
Try this: (fully dynamic...)
Get the data first and then display it later.