@pcthugMay 02.2006 — #Here is a basic example of such:[code=php] <?php $file = 1; $increasenumber = ++$file; //$increasenumber will make $file(1) go up to the next number echo $increasenumber; ?>[/code]
@Heavy_MetalauthorMay 02.2006 — #pcthug, it doesn't seem like that would make the number in the file change to the next number (I.E. 1 going to 2, 500 going to 501, no matter what the number is)
spectrereturns, i dont want to record the new number, i want to change the number in the file, from whatever it is to the next number, like auto_increamate in a DB
@Heavy_MetalauthorMay 03.2006 — #also can anyone tell me what this [code=php]$num = $read1 + $read2 + $read3 + $read4;[/code] is all about? I saw this variable in a code that i downloaded to look at and I dont understand why they added variables inside a variable and what that would do... can someone please explain?
@balloonbuffoonMay 03.2006 — #[code=php] $num = $read1 + $read2 + $read3 + $read4; [/code]This sets the variable $num to the sum of the values $read1, $read2, $read3, and $read4.
For your incrementing file thing, you could do the following: [code=php]$filename = "count.txt"; $org = file_get_contents($filename); $org++; file_put_contents($filename,$org);[/code]You must have PHP 5, since it uses [I]file_put_contents[/I], but that can be switched out for more code that does the same thing and will work with earlier versions of PHP.