Jump to content

How to clear cache in php script...


slaterino

Recommended Posts

Hi,

I've got a script that generates a list of the next seven days. However, as today becomes tomorrow it seems that the dates are not changing automatically as they should do! Does php sometimes store data in a cache. How can I reset this so that this won't happen?

 

I'm using this query to capture the date, and do a bit of coding with it, and then I'm echo'ing the date later in the script. How can I make sure it changes as soon as midnight hits?

 

$sql = "SELECT post_id, 
DATE_FORMAT(start,'%m/%d/%Y') AS eventStart, 
DATE_FORMAT(end,'%m/%d/%Y') AS eventEnd,
DATE_FORMAT(CURDATE(),'%m/%d/%Y') AS today,
DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL 7 DAY),'%m/%d/%Y') AS endWeek 

FROM   wp_ec3_schedule s
JOIN   wp_posts p ON p.ID = s.post_id
WHERE   post_status = 'publish' ";
$clause = array();
for( $i = 0; $i < 7; $i++ ) {
$clause[] = "DATE_ADD(CURDATE(), INTERVAL $i DAY) BETWEEN DATE(start) AND DATE(end)";
}

$sql .= "AND (" . implode(' OR ', $clause) . ")"; 
$sql .= ' ORDER BY start DESC';
$result = mysql_query($sql) or trigger_error($sql . ' has failed. <br />' . mysql_error()); //pull data from database.

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.