It is to return the last 10 entries from the db and then any entries above 10 to display in a different way
I have the following
Code: Select all
// Select the first 10 posts
$lastweek = "SELECT art, titles,
DATE_FORMAT(create, '%a, %b %D, %Y') AS detim
FROM blog
ORDER BY create DESC LIMIT 10";
//select the rows after 10 (and display in a different way)
$sql = "SELECT arti,
DATE_FORMAT(create, '%M %Y') AS monyr,
MONTH(create) AS mon,
YEAR(create) AS yr,
COUNT(*) AS cnt
FROM blog
WHERE arti > 10 //this isnt working here
GROUP BY monyr
ORDER BY yr DESC, mon";
I can do this with date (below works as intended) and have the first lot from the last week and the rest displayed over a week old but i would like to do it by amount rather than dates
Code: Select all
// Select posts for this previous week
$lastweek = "SELECT article, titles,
DATE_FORMAT(create, '%a, %b %D, %Y') AS date
FROM blog
WHERE create > DATE_SUB(NOW(), INTERVAL 1 WEEK)
ORDER BY create DESC";
// Select posts grouped by month and year
$sql = "SELECT DATE_FORMAT(create, '%M %Y') AS monyr,
MONTH(create) AS mon,
YEAR(create) AS yr,
count(*) AS cnt
FROM blog
WHERE create < DATE_SUB(NOW(), INTERVAL 1 WEEK)
GROUP BY monyr
ORDER BY yr DESC, mon";
Thanks