Evening Guys and Girls
I have a query about php and mysql and if it can be done or a recmmendation of the language to use.
I have a website that calls data from a database to show up and coming events of music gigs and festivals. It displays all this information in a formatted table.
I am happy with this but my question is when the gig is passed, I would like to it to be removed from the database and therefore not show on the site anymore automatically without author intervention.
Is there a function/query I can use to compare end date to system date world time etc and best use to impliment it.
Guidelines and a push in the right direction would be much appreciated
Kind regards
Cameron
PHP and MySQL tables
Moderator: General Moderators
-
klevis miho
- Forum Contributor
- Posts: 413
- Joined: Wed Oct 29, 2008 2:59 pm
- Location: Albania
- Contact:
Re: PHP and MySQL tables
You should get the date from the gig(from the database) and compare it to the date now.
If the date of the gig is smaller than the date now, then delete that gig from the db.
If the date of the gig is smaller than the date now, then delete that gig from the db.
Re: PHP and MySQL tables
You might want to keep those gigs for historical reference, but just not show them on the site. You can change the database query that fetches the gigs to filter out gigs that have taken place already. Something like
Where gigs is the table and performance_time would be the relevant column.
Code: Select all
WHERE gigs.performance_time > NOW()-
klevis miho
- Forum Contributor
- Posts: 413
- Joined: Wed Oct 29, 2008 2:59 pm
- Location: Albania
- Contact:
Re: PHP and MySQL tables
Or, run a cronjob once a day, to remove the gigs.