Jump to content

[SOLVED] Need To Search DB Based On Last 5 Days


refiking

Recommended Posts

I need the query to check for records that were updated within the last 5 days.  How can I add that to this script?

 

//datetime_last_updated is the field that I need to check to see if it was updated in the last 5 days
$result = mysql_query("SELECT * FROM heap ORDER BY datetime_last_updated ASC LIMIT $limit ")or die(mysql_error());

<?php

$five_days = (60*60*24*5);
$five_days_ago = time() - $five_days;

//query to be done after db connection

$query = "SELECT * FROM heap WHERE datetime_last_updated > $five_days_ago";
$result = mysql_query($query)or die(mysql_error());

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.