Jump to content

Please Help with my podcast list


ansonb

Recommended Posts

I am working on a podcast list script.

 

It displays the results of my mysql query correctly, but shows the results in 1 long list.

 

$query3 = "SELECT * FROM podcasts WHERE show_id = $show_id ORDER BY airdate DESC"; 
$result3 = mysql_query($query3) or die(mysql_error());

 

I would like to further filter the results instead of 1 hugely long list. For example, view by year, month etc...

The 'airdate' is stored in the database as DATETIME.

 

Is there a way to seperate the parts of the date: year, month, day using php ??

 

And if so how would I go about displaying only the podcasts for a specific year or month etc. ??

 

website located at http://www.eliteweboffers.com/lwr/podcasts.php

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/257016-please-help-with-my-podcast-list/
Share on other sites

There are many date/time function built into MySQL:

http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html

 

 

For example, if you're looking to show all podcasts since 2011, you could try something like:

 

$sql = "SELECT * FROM podcasts WHERE YEAR(airdate) > 2011";

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.