I have found place online where they answer different things, but I still don’t get how I can apply it to my code.
Basically I want the month in one echo-line, and the day-number in another echo.
Is there away to do that in my code?
<?php
// Connects to your Database
$data = mysql_query("SELECT id, title, description, location, date FROM Calendar")
or die(mysql_error());
while($row = mysql_fetch_array( $data ))
{
echo "<article>";
echo "<date>";
echo "<h3>" .$row['date(month)'] . "</h3>";
echo "<h4>" .$row['date(day)'] . "</h4>";
echo "</date>";
echo "</article>";
}
?>
Here’s a way to get them ahead of time in your MySQL query, as an alternative to parsing them out later in PHP.
Then to access them:
Alternatively to get the month’s name instead of number, use
DATE_FORMAT(date, '%M') as monthMySQL
DATE_FORMAT()documentation