Re: Is This Code OK?
| From: | Teodor Cimpoesu | Date: | Sat, 21 Oct 2000 13:25:47 +0000 |
| Subject: | Re: Is This Code OK? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-21548@lists.php.net to get a copy of this message | ||
Hi Joe!
On Sat, 21 Oct 2000, Joe Stump wrote:
> This is how I would do it (I'm a unix geek so this won't work for you NT
> people).
:)
> <?
>
> $file = '/tmp/data.txt';
>
> $fp = fopen($file,'r');
> $value = fread($fp,filesize($file));
> fclose($fp);
>
> $new_value = ($value + 1);
>
>
echo "\$hits = $new_value" > $file;
>
> ?>
>
> Double check my syntax on the echo "\$hits = $new_value" >
> $file;
but what is Joe & Susane happen to hit the page at the same time?
that's the locking issue we are used the DB to take care of.
-- teodor