I have a sql query that gets all the events from a specified month and should put the values into an array.print _r shows the values are being pulled from the database.
I can't get this to work.
Any suggestions appreciated.
Code
$events = array();
global$wpdb;
echo $month;
echo $year;
$query=("SELECT title, DATE_FORMAT(event_date,'%Y-%m-%e')AS event_date FROM sw_appointments WHERE YEAR(event_date) = $year AND MONTH(event_date) = $month");
$result = $wpdb->get_results($query,ARRAY_A);
print_r($result);
foreach( $result as $results ) {
$events=$results->event_date;
echo $events;
}