Here I give you:
<CENTER>
<H1>MySQL Database</H1>
</CENTER>
<?php
// Database connection
require ("../db.cnf.php");
$sql = mysql_query("SELECT * FROM table ORDER BY column ASC");
echo "<table border='0' CELLPADDING=5 STYLE='font-size:13px'>";
echo "<tr> <td><H3>Column 1 Name</h3></td> <td><H3>Column 2 Name</H3></td> <td><H3>Column 3 Name</H3></td><td><H3>Column 4 Name</H3></td></tr>";
// keeps getting the next row until there are no more to get
while ($row = mysql_fetch_array($sql)) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['Column 1 Name'];
echo "</td><td>";
echo $row['Column 2 Name'];
echo "</td><td>";
echo $row['Column 3 Name'];
echo "</td><td>";
echo $row['Column 4 Name'];
echo "</td></tr>";
}
echo "</table>";
?>
Hope this helped you.
|