Results 1 to 3 of 3
Thread: A query to hide all past events?
Jan 20, 2005, 13:04 #1
- Join Date
- Oct 2003
- Land of the free, home of the brave
- 0 Post(s)
- 0 Thread(s)
A query to hide all past events?
I know a little about PHP/MySQL.
I have a MySQL database and admin panel setup where I can go in and add event dates for this website.
I want to take things a step further. I want the past event dates to automatically "hide" themselves from being seen on the website, yet not get deleted from the database. A friend of mine suggested adding a new field to my current database to make this happen somehow.
I have attached a screenshot of my database. Do you have any ideas?
I appreciate your help,Elise Henley
Jan 20, 2005, 14:02 #2
Your thumbnail is interesting, but not useful.
We need to see the table definition, otherwise known as DDL.
I have an awful feeling that the data in your [date] field is not of the datatype "DateTime", but is actually a varchar or something.
Also, it is never a good idea to have columns named things like "date" and "time". They could easily be (although luckily not for mysql) reserved words.
MySQL allows some keywords to be used as unquoted identifiers because many people have already used them. Examples are those in the following list:
Jan 20, 2005, 16:01 #3
- Join Date
- Jul 2002
- Toronto, Canada
- 63 Post(s)
- 3 Thread(s)
you could add a column to the table to indicate that a particular entry was expired or not
and then when you are returning data from the database to show on the web site, the query would have
... where expired = 0
you could, but it wouldn't be a good idea
you'd have to constantly (e.g. on a daily basis) go through the table and flag any rows that had lapsed into expired status
instead, it is more common simply to omit showing them based on the current date
... where event_date >= current_date