...

View Full Version : compare day and last run



docock
12-18-2008, 12:39 PM
In the code below, I retrieve the current day and read out a text file which contains the last day the code ran. If the current day and the day in the text file are different from each other the the variable $nieuw should get the value 1, otherwise the value 0.

But somehow, this doesn't work. When I try the coding the variable $nieuw returns 1 every time. Whats wrong with my coding?


$michael=Date("d");

$handle = fopen("filed.txt","r+"); //mind the + this means to write AND read
$read = fread($handle,filesize("filed.txt"));
if ($read<>$michael){fwrite($handle,$michael);$nieuw="1";}else{$nieuw="0";}
fclose($handle);

echo $nieuw;

ohgod
12-18-2008, 01:37 PM
try echo'ing out the 2 dates being compared too, maybe there is some screwy formatting you're not seeing causing them to be inequal



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum