Jump to content

Recommended Posts

I would like to know the best practice to achieve the following:

 

I have a list of dates related to live events for performing artists.  When someone views the web page that contains a section to display the dates, I would only want to show the dates from today into the future and not show any dates from the past.

 

What is the best way to accomplish this?

 

Thanks in advance...

The following queries will get only the rows with the date greater than the moment it's executed.

 

NOW() -> datetime (2011-05-02 12:06:10)

SELECT col1, col2 FROM table WHERE date>=NOW()

 

CURDATE() -> date (2011-05-02)

SELECT col1, col2 FROM table WHERE date>=CURDATE()

That would quite more complicated and really slow, but it's easily accomplished. However, without giving us a few event lines, we can't give a proper working solution.

 

PS: You should really opt for a database approach. It will be 100x easier to handle (inserts, updates, whatever).

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.