Jump to content

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";

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.