Jump to content

Displaying only one month and year per article?


cturner

Recommended Posts

Can someone please tell me how I can do what is in the subject? Thanks in advance.

Here is the code that I am working with:
[code]
require "config2.php";
// display each article title with the date
// get the current day
$currentday = date("j",mktime());

// get the current month
$currentmonth = date("F",mktime());

// get the current year
$currentyear = date("Y",mktime());

// select the current article
//$currentquery = mysql_query("SELECT * FROM `items` ORDER BY STR_TO_DATE(CONCAT(selectDay, selectMonth, selectYear), '%d%M%Y') DESC");
$currentquery = mysql_query("SELECT * FROM `items`");

while($row = mysql_fetch_array($currentquery)) {
echo "<br /><br /><a href=article.php?articleid=".$row['articleid'].">".$row['selectMonth']." ".$row['selectYear']."</a>";
}
// display the current article
//while($row = mysql_fetch_array($currentquery)){
//echo "<br /><br />".$row['selectDay']." ".$row['selectMonth']." ".$row['selectYear']."<br />";
//echo "<a href=article.php?articleid=".$row['articleid'].">".$row['articletitle']."</a>";
//}

mysql_close();
[code][/code][/code]

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.