samedi 22 mai 2021

How do I present this data?

Assume I have 2 tables right now. Kind of a ultra basic blog site.

User table (id, firstname, lastname, email, password, created_at, updated_at)

Post table (id, post_author_id, post_author_firstname, post_title, post_content, post_image, post_date, created_at, updated_at)

Assume I want to display all posts by the user for each particular day.

However I want to present the data in this format.

There is one big heading i.e. the date so 21st may. All the posts that were posted that day by that user will be under this heading. The post title, author, content and image and the time the post was posted will only show. This is because the big heading (21st may) reveals the date it is posted anyway. So there is no point having to show date again when I only want need to list timing of post. How would I go about coding this logic using php and mysql?

I also attached a picture for guidance. what I want the logic to be able sort my data like and look like

Aucun commentaire:

Enregistrer un commentaire