Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in SQL by (5k points)

I want to show values retrieved from a database table in a HTML table page. I did a lot of research but I could not find any answer to it. The database table name is tickets, it contains 6 fields right now (submission_id, formID, IP, name, email, and message) but should have another field called ticket_number. Please help me out with this.

<table border="1">


    <th>Submission ID</th>

    <th>Form ID</th>










    <td>John Johnny</td>

    <td>[email protected]</td>

    <td>This is the message John sent you</td>



1 Answer

0 votes
by (10.2k points)

Please follow the code given down below:



// Check connection

if (mysqli_connect_errno())


echo "Failed to connect to MySQL: " . mysqli_connect_error();


$result = mysqli_query($con,"SELECT * FROM Persons");

echo "<table border='1'>





while($row = mysqli_fetch_array($result))


echo "<tr>";

echo "<td>" . $row['FirstName'] . "</td>";

echo "<td>" . $row['LastName'] . "</td>";

echo "</tr>";


echo "</table>";



If you want to get more insights into SQL, checkout this SQL Course from Intellipaat.

Related questions

Browse Categories