I have a lot of dates stored in the database like so:
2017-06-01
And there are different months worth of data in the database. I want to show this in a dropdown menu so that a user would see:
April 2017 May 2017 June 2017
I tried this in a while loop as a start to try get the month alone:
$month = date('F', strtotime($row['b_date']));
but it just shows January 7 times.
$stmt = $link->prepare("SELECT 'b_date' FROM `summary`");
$stmt->execute();
$result = $stmt->get_result();
$numRows = $result->num_rows;
if($numRows > 0) {
while($row = $result->fetch_assoc()) {
$month = date('F', strtotime($row['b_date']));
echo "<option value=''>{$month}</option>";
}
}