Jump to content

date grab help?


elis

Recommended Posts

I want a script to run and only pull data that was updated in the last seven days based on the date attached to the field.

 

Here's my script so far

$query="select *,DATE_FORMAT(date, '%M %d, %Y') AS updated from member_entries where validated > 0";
$showresult = mysql_query($query) if(!$showresult) { usererror();}

 

I don't know how to pull data that was updated within the last seven days based on $query[updated] field.

I tried using MKtime() but that seems as if it's based on today and I want it to based on the last designated pull day (ie last Sunday) so that it's not reupdating each day and only once a week.

Would this work better as a cron?

 

 

Link to comment
Share on other sites

I've edited the code since and have changed my concept to something much easier, but still need help.

 

Let's say I have two date-based variables: $updatedon and $lastvalidate

What I have in mind is comparing the two dates like:

 

if ($updatedon > $lastvalidate) 
{ 
//positive handle
} else 
{
//negative handle
}

 

But I want to add seven additional days to whatever the $lastvalidate field brings. How would I do that?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.