Home | Products | Consulting | Forums | Support | Order | 1-800-752-0455
  Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
Link to display records in last 7 days

 

 


rjbathgate
User

Dec 4, 2008, 4:43 AM

Post #1 of 2 (292 views)
Shortcut
Link to display records in last 7 days Can't Post

Hi guys,

I'm looking to make a link to a list page which passes the criteria:

all records from said table where created date (i.e. date entered into database) is within the last X (7) days.

I already had the standard list page all set up - i just need to send the 'last 7 days' criteria through.

Is this possible?

Or do I need a new listing page, which is set to only display results from last 7 days by default, and simply link straight to that?

I already have code to display records on a list page where the date is within x days from today, so I can do the latter option, but the easier option would be the criteria in the url to the existing listing page (then I don't have to make a new listing page).

Many thanks in advance
Rob


Dave
Staff / Moderator


Dec 5, 2008, 3:56 PM

Post #2 of 2 (255 views)
Shortcut
Re: [rjbathgate] Link to display records in last 7 days [In reply to] Can't Post

Hi Rob,

You need a little custom PHP and MySQL for this:

Assuming your viewer url looks like this: yourViewer.php?days=7

You could get the days like this:

<?php
$days = (int) @$_REQUEST['days'];
if (!$days) { $days = 7 } // set default
$escapedDays = mysql_real_escape_string($days);
?>

And do a query like this:

'where' => "createdDate <= (NOW() - INTERVAL $escapedDays DAY) "

Let me know if that works for you.

Dave Edis - Senior Developer
interactivetools.com

 
 
 


Search for (options)
Products
CMS Builder
Article Manager
Realty Manager
Listings Manager
Order Now
Services
Priority Consulting
Support
Online Documentation
Support Forums
Support Homepage
Company Info
12 reasons to choose us!
Meet the team
Monthly newsletter
Contact Us
Toll Free: 1-800-752-0455
Phone: (604) 689-3347
Sales | Support
Conditions of Use | Privacy Policy | Copyright © interactivetools.com 2008
#201 - 2730 Commercial Drive, Vancouver BC Canada V5N 5P4