Can anybody help - most articles have the same date as the creation date in th list but it's correct on the actual articles.
Here's the block codes:
global $db_prefix, $scripturl, $user_info;
$query = db_query(
"SELECT subject, id, date, shortname
FROM {$db_prefix}tp_articles
WHERE approved = 1
ORDER BY date DESC
LIMIT 20", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
if(empty($row['shortname'])) $row['shortname'] = $row['id'];
echo '<font size="1pt"><b><a href="' . $scripturl . '?page=' . $row['shortname'] . '">' . $row['subject'] . '</a></b><br>- '. date("M n, Y - g:ia", $row['date']) . '</font><br />';
}
http://www.pre-cert.co.uk/
There is only one date field in 0.98 articles; the SQL query *should* be ordering the results as such (numerically so that the highest timestamp appears first in your list) but I see on your site it is not...
Indeed - it's a mystery.
You have a problem in your date function:
date("M n, Y - g:ia", $row['date'])
n is the code for the umeric representation of a month, without leading zeros. So, for articles created in October, it will always print out "Oct 10" and for articles created in September, it will always print out "Sep 9." You need to change it to
date("M j, Y - g:ia", $row['date'])
All of the formatting options are given here (http://us.php.net/date).
Fabulous - much appreciated. All is now working. ;)
Thanks JPD. Couldn't see the trees for the forest type of thing there...
Happens to me all the time. That's the advantage of having a number of people available to look at things.