Jump to content

Recommended Posts

Hello, I have a database where each post has a  corresponding date/time:

 

DATABASE

Post 1. 2012-08-12 18:20:15

Post 2. 2012-08-12 16:30:00

Post 3. 2012-08-11 18:20:15

Post 4. 2012-08-10 13:20:30

 

When looping through and showing the results I want to put a <br /><br /> when there is a new day , but how do I do this?

 

I can only separate them if the the exact time is same on all posts...

if ($row['date'] != $previousloopdate){
echo "<br /><br />";
}

Thanks

Link to comment
https://forums.phpfreaks.com/topic/267082-loop-through-and-enter-when-new-day/
Share on other sites

Thanks for answer. I have been looking into these but cannot fully grasp it.. is there any way I can use code like this? But instead specify if the date is the same, regardless of time..

if ($row['date'] != $previousloopdate){
echo "<br /><br />";
}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.