I’m grabbing a purchase date from the database (using simple commerce). You can see that I display it, along with the member ID with two ECHO statements. All good. Then I do some calculations to get a start date for my channel statement later on…for some reason, as I was testing, the date it comes back with is cached for the previous user account I was logged into (so, even though it is displaying the new date as the join/purchase date, the calculated start date is based on the join/purchase date of the previous account I logged in with). The server has to be caching this, but I can’t understand why. Is this normal, for PHP to cache something like this?
The error is happening when I call mktime…it’s using the values from the previous member id that I logged in with before.
I tried clearing all the cache’s, and nothing worked.
Sharon
{exp:query sql="SELECT purchase_date FROM exp_simple_commerce_purchases WHERE member_id = <?php echo $member_id;?>"}
<?php
$purchyear = '{purchase_date format="%Y"}';
$purchmonth = '{purchase_date format="%m"}';
$purchday = '{purchase_date format="%d"}';
echo '<b>Member ID:</b> '.$member_id.'';
echo '<b>Join Date:</b> '.'{purchase_date format="%M"}'.' '.'{purchase_date format="%d"}'.', '.'{purchase_date format="%Y"}'.'';
$time = mktime(0, 0, 0, (int)$purchmonth, (int)$purchday, (int)$purchyear);
$newdate = strtotime ( '+0 years +0 months -1 week +0 days' , $time) ;
$start_time = date('Y-m-d H:i', $newdate);
echo 'Start From:'.$start_time.'';
?>
{/exp:query}