So this PHP Code would print all the table data from my database on a Web-Page.
<?php
$hostname = '127.0.0.1:3306';
$dbname = 'login'; // Your database name.
$username = 'root'; // Your database username.
$password = ''; // Your database password. If your database has no password, leave it empty.
mysql_connect($hostname, $username, $password) or DIE('Connection to host is failed, perhaps the service is down!');
mysql_select_db($dbname) or DIE('Database name is not available!');
$query="SELECT * FROM markers";
$result=mysql_query($query);
$fields_num = mysql_num_fields($result);
echo "<table border='2'><tr>";
// printing table headers
for($i=0; $i<$fields_num; $i++)
{
$field = mysql_fetch_field($result);
echo "<td>{$field->name}</td></div>";
}
echo "</tr>
";
// printing table rows
while($row = mysql_fetch_row($result))
{
echo "<table>";
echo "<tr>";
echo "<td>$row[0]</td>";
echo "<td>$row[1]</td>";
echo "<td>$row[2]</td>";
echo "<td>$row[3]</td>";
echo "</tr>
";
echo "</table></div>";
}
?>
But what Essentially it's doing is that. It's not properly formatted.It comes like this.
What I wanted to do Is to bring this table exactly in the center of the web-page, Give it some fancy borders(curvy edges, Great fonts.)