• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 177
  • Last Modified:

Show recent records on news page and older records on archive page


I have a 'news page' with the most recent (say this months') records listed. I need to create an 'archive page' with the continuation of those records listed (after this months').

This link shows example:-
(link to 'archive' at the bottom of the page)

This is my actual page:-
1 Solution
Copy your page news.php and name it archiveNews.php,

Now change both your database queries to include a date filter. ie

Select * from News where date > (Select getdate()-30)) on the News.php page
Select * from News where date <= (Select getdate()-30))

That is if you have a date coloumn on your table.

Have fun
Jason C. LevineNo oneCommented:
Hi kaz0161,

You would need to store all news entries in a mysql table and use PHP and mysql queries to pull them out as desired.  

What exactly is your question?
kaz0161Author Commented:
I have a mysql table which is called 'property', 'date' is my column and it is all populated. I am using dreamweaver but am struggling with how to use php and mysql queries to get one page of recent records and one page of the continued older records.

A friend suggested this:-

$newstime = mktime(0, 0, 0, date("m")-2, date("d"),   date("Y")); // Change the 2 to the number of months ago you want
$query_rs_Images = "SELECT id, filename, heading, `description` FROM news WHERE date > ".$newstime." ORDER BY date DESC";

I shall try your suggestion jtdebeer (yours seems less complicated) and will get back to you tommorrow when im in work. Hopefully all will be well.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now