Use the code below, edit all the red text with correct data.
<?php
$db_host = 'HOST';
$db_user = 'USER';
$db_pwd = 'PASS';
$database = 'DB';
$table = 'TABLE';
if (!mysql_connect($db_host, $db_user, $db_pwd))
die("Can't connect to database");
if (!mysql_select_db($database))
die("Can't select database");
// sending query
$result = mysql_query("SELECT
`TABLE`.FIELDNAME(DAY),`TABLE`.FIELDNAME(MONTH),`TABLE`.`FIELDNAME(YEAR)`
FROM
`TABLE`
LIMIT 0 , 30");
if (!$result) {
die("Query to show fields from table failed");
}
$fields_num = mysql_num_fields($result);
echo "<table border='0'><tr>";
// printing table headers
for($i=0; $i<$fields_num; $i++)
{
$field = mysql_fetch_field($result);
echo "<td>{$field->name}</td>";
}
echo "</tr>\n";
// printing table rows
while($row = mysql_fetch_row($result))
{
echo "<tr>";
// $row is array... foreach( .. ) puts every element
// of $row to $cell variable
foreach($row as $cell)
echo "<td>$cell</td>";
echo "</tr>\n";
}
mysql_free_result($result);
?>
Save as PHP, if html phasing isn't enabled. Data should appear, In the correct format you wish.
If this information was helpful. Please add to my rep. Thanks