Not incrementing?
| From: | Kyle Babich | Date: | Sat, 21 Jun 2003 00:07:45 +0000 |
| Subject: | Not incrementing? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-152359@lists.php.net to get a copy of this message | ||
I have a file, current.txt, that at the start has only the digit 1 in it. Here is my code:
$current = readfile('setupData/current.txt');
foreach ($HTTP_POST_VARS as $index => $value) {
$index = $HTTP_POST_VARS['$index'];
}
$info = fopen("postInfo/{$current}-{$dateFile}.txt", 'w');
fwrite($info, "$author\n$email\n$dateActual");
fclose($info);
$entry = fopen("postEntries/{$current}-{$dateFile}.txt", 'w');
fwrite($entry, $body);
fclose($entry);
$currPost = fopen('setupData/current.txt', 'w');
fwrite($currPost, $current + 1);
echo $current;
fclose($currPost);
Two files are created in seperate folders, each with the same name, the current number in
current.txt, a dash, then a series of numbers and letters that represent the current date and time
exactly. That happens correctly, but then the number inside of current.txt is supposed to
increment. Every pair created should be the next number, a dash, then the date and time. It will
increment once to 2, but all created files are 1- and nothing else happens no matter how much I do
it. What went wront?
Thanks,
--
Kyle