Logo Luan Morina
Select MySQL table rows with the current day and month
YearEvent
1620 Mayflower Compact signed by Pilgrims in Providencetown MA harbor
1624 Jakob B”hme German philosophical mystic dies (birth date unknown)
1783 Pilƒtre de Rozier & Marquis d'Arlandes make 1st free balloon flight
1789 NC becomes 12th state
1794 Honolulu Harbor discovered
1847 Phoenix is lost on Lake Michigan
1933 1st US ambassador to USSR - WC Bullitt
1934 Yanks buy Joe DiMaggio from SF Seals
1952 1st US postage stamp in 2 colors (rotary process) introduced
1959 Jack Benny (Violin) & Richard Nixon (Piano) play their famed duet
1964 World's longest suspension bridge Verrazano Narrows Bridge opened
1980 Gene Michaels replaces Dick Howser as Yankee's 25th manager
1980 Who Shot JR episode of Dallas

Query

SELECT * FROM today_in_history WHERE DAY(mcm_date)=DAY(NOW()) AND MONTH(mcm_date)=MONTH(NOW()) LIMIT 0, 60

Source code

$conn = new mysqli ("server", "user", "password", "database");
mysqli_set_charset ($conn, "utf8");
if ($conn -> connect_error) {
die ("Error: " . $conn->connect_error);
} 
$sql = "SELECT * FROM today_in_history WHERE DAY(mcm_date)=DAY(NOW()) AND MONTH(mcm_date)=MONTH(NOW()) LIMIT 0, 60";
$result = $conn -> query($sql);
echo "<table id='demoTable' class='table table-striped'>";
echo "<thead>";
echo "<tr>";
echo "<th>Year</th>";
echo "<th>Event</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>"; 
while ($row = $result -> fetch_assoc()) { 

$var_year = date_create($row["mcm_date"]);

echo "<tr>";
echo '<td>' . date_format($var_year, 'Y') . '</td>' . "\n";
echo "<td>" . $row["mcm_event"] . "</td>";
echo "</tr>";
}

echo "</tbody>";
echo "</table>";
$conn -> close();
?>
   Select table rows with the current day and month