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]
Link to comment
Share on other sites

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.