The given PHP example helps you to display all the rows and the fields of a table. Code Example:
<?php $server = "localhost"; $username = "root"; $password = ""; $database = "school"; $conn = mysql_connect($server, $username, $password) or die("Couldn't connect to MySQL" . mysql_error()); mysql_select_db($database, $conn) or die ("Couldn't open $test: " . mysql_error()); $result = mysql_query("SELECT * FROM student"); $records = mysql_num_rows($result); echo "$records records have been added into the table."; echo "<table>"; while ($row = mysql_fetch_row($result)){ echo "<tr>"; foreach ($row as $field){ echo "<td>".stripslashes($field)."</td>"; } echo "</tr>"; } echo "</table>"; mysql_close($conn); ?>