Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8811951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:29:19+00:00 2026-06-14T03:29:19+00:00

I have a list that’s being populated from the database it’s sorted using the

  • 0

I have a list that’s being populated from the database it’s sorted using the time field by ASC dates. I’m using the <?php foreach() :?> to loop through and populate the list .

<li id="events">
Time: <?php echo $venue['time']; ?> 
Event: <?php echo $venue['location']; ?> 
</li> 

I have a variable in php called ($time_left ) that keeps track of the days left till each event begins I calculate this by taking the time field from the database subtracting today’s current date with php date() when this reaches 0 how can I remove the expired event from the start of the list and append it to the end.

This can be done on page refresh I don’t need it to be asynchronous. Can I do this just in PHP with DOM manipulation? or should I use Jquery and if so how do I pass the $time_left variable from PHP to my Jquery script?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:29:20+00:00Added an answer on June 14, 2026 at 3:29 am

    this looks simple enough. I hope i didn’t misunderstand something. it should be something like this.

    foreach($venues as $k => $venue) {
        $passEvents = array();
        $currentTime = time();
        if(($venue['time'] - $currentTime) <= 0) {
            $passEvents[] = $venue;
        } else {
            echo '<li id="events">';
            echo 'Time: '.$venue['time']; 
            echo 'Event: '.$venue['location']; 
            echo '</li>';
        }
    }
    
    foreach($passEvents as $k => $venue) {
        echo '<li id="events">';
        echo 'Time: '.$venue['time']; 
        echo 'Event: '.$venue['location']; 
        echo '</li>';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list that is being retrieved from the database. The number of
I have a list that I am trying to fill with numbers from a
I have this list that can be sorted with sortable. How can I move
I have a list that I need to fill using a JSON collection of
I have a list that will filter in input in an EditText field and
I have a list that is dynamically populated, I want to get the indices
in Android, I have list that I fill using the following code @Override public
I have a list of ints[] that I list one at a time. I
I have a list that is populated by a listadapter that specifies a layout
I have a list that is pulled from three tables, Department, Type and User.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.