TV Guide script - getting current date programmes to show
Posted
by whitstone86
on Stack Overflow
See other posts from Stack Overflow
or by whitstone86
Published on 2010-05-17T18:25:32Z
Indexed on
2010/05/17
18:30 UTC
Read the original article
Hit count: 151
This is part of my TV guide script:
//Connect to the database
mysql_connect("localhost","root","PASSWORD");
//Select DB
mysql_select_db("mytvguide");
//Select only results for today and future
$result = mysql_query("SELECT programme, channel, episode, airdate, expiration, setreminder FROM mediumonair where airdate >= now()");
The episodes show up, so there are no issues there. However, it's getting the database to find data that's the issue.
If I add a record for a programme that airs today this should show:
Medium showing on TV4 8:30pm "Episode" Set Reminder
Medium showing on TV4 May 18th - 6:25pm "Episode 2" Set Reminder
Medium showing on TV4 May 18th - 10:25pm "Episode 3" Set Reminder
Medium showing on TV4 May 19th - 7:30pm "Episode 3" Set Reminder
Medium showing on TV4 May 20th - 1:25am "Episode 3" Set Reminder
Medium showing on TV4 May 20th - 6:25pm "Episode 4" Set Reminder
but this shows instead:
Medium showing on TV4 May 18th - 6:25pm "Episode 2" Set Reminder
Medium showing on TV4 May 18th - 10:25pm "Episode 3" Set Reminder
Medium showing on TV4 May 19th - 7:30pm "Episode 3" Set Reminder
Medium showing on TV4 May 20th - 1:25am "Episode 3" Set Reminder
Medium showing on TV4 May 20th - 6:25pm "Episode 4" Set Reminder
I almost have the SQL working; just not sure what the right code is here, to avoid the second mistake showing - as the record (which indicates a show currently airing) does not seem to work at present.
Please can anyone help me with this?
Thanks
© Stack Overflow or respective owner