I've created a custom WordPress database table which I'm using to store 'likes'.
The columns I have are:
I'm now trying to get an array of post IDs that a particular user has 'liked'. So far I have this:
$my_array_of_post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT post_id FROM like WHERE user_id = %d", $user_id ) );
How can I ensure my
$my_array_of_post_ids array is sorted so that the most recent 'like' is the first item in the array, the second most recent 'like' is 2nd, the third most recent 'like' is 3rd and so on?