<?php
$file_name = 'test.txt';
$new_value = rand(1000, 1000000);

$f = fopen($file_name, 'rw+');
$s = explode("\n", fread($f, filesize($file_name)));
$s[1] = substr($s[1], 0, 11) . $new_value;
fseek($f, 0);
fputs($f, implode("\n", $s));
fclose($f);
?>

"Craig Westerman" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have a simple count file named count_db that contains ONLY the
following:
>
> {
> 'total' => 39540000
> }
>
> How do I open file, find numbers in the file, add $newnumbers to existing
> numbers. Then write these new numbers over the original numbers and close
> the file. I'm just needing to do this once a day to correct a poor count.
>
> Thanks
>
> Craig ><>
> [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to