Link to display records in last 7 days

2 posts by 2 authors in: Forums > CMS Builder
Last Post: December 5, 2008   (RSS)

Re: [rjbathgate] Link to display records in last 7 days

By Dave - December 5, 2008 - edited: March 1, 2010

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