The problem here is that implode
will take an array of strings, and join them together using a glue parameter, such as commas.
But by your own admission, $low_date
is not an array of strings. It’s an array of objects! Objects are not strings. Here each row is an object, where you have only a single parameter because in your query you asked for a single named option.
So you have several generic PHP methods to get the date out:
- You could loop over the rows, and add the dates to a second array which you then use in
implode
- You could walk over the array using something like
array_map
to replace each item in the array with the date, classic functional programming - You could loop over and echo each date and wrap it in a
<time>
tag ( as you should be doing for semantic reasons anyway ), then you could add the commas using CSS
However, since this is WPSE, and to keep this on-topic you need also have 2 other options:
- Use
wp_list_pluck
to create a new array by plucking out just the date field - Ask
get_results
to return a numbered or associative array instead using the second parameter it accepts, as documented on the official developer hub