GetDotted Domains

Viewing Thread:
"PHP for incrementing a variable please."

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Sat 31/05/03 at 16:07
Regular
Posts: 787
I'd look it up myself, but you people are so much help :D

PS, I'll show you why this afternoon sometime!
Sat 31/05/03 at 16:35
Regular
"Eff, you see, kay?"
Posts: 14,156
$var++ will increment a variable.

$var = 2;
echo $var++; // prints 2

$var = 2;
echo ++$var; // prints 3

$var = 2;
echo $var--; // prints 2

$var = 2;
echo --$var; // prints 1
?>

Any questions?
Sat 31/05/03 at 16:34
Regular
"Pouch Ape"
Posts: 14,499
Hmm, it;s not working. I know PHP pretty well and how to set up permissions and stuff, yet this is still eluding me.
Sat 31/05/03 at 16:17
Regular
"Pouch Ape"
Posts: 14,499
Cheers - it's for my new and improved chat room! I deleted the code that did the increment bit and couldn't remember how to do it.
Sat 31/05/03 at 16:14
Regular
Posts: 20
monkey_man wrote:
> I'd look it up myself, but you people are so much help :D
>
> PS, I'll show you why this afternoon sometime!

First, create a blank file. Name it counterlog.txt

Then create a new file. Copy/paste this into it.

$viewss = file("counterlog.txt");
$views = $viewss[0]; $views++;
$fp = fopen("counterlog.txt", "w");
fwrite($fp, $views);
fclose($fp);
print $views;
?>


Save it as counter.php. Then you use include to get the code on whichever page you want.

include ("counter.php");
?>



Upload the files and chomod counterlog.txt to 766, and you should have a brand new counter

If you ever want to change the number of visitors (You evil cheater :P), open counterlog.txt, and edit the number to what you want. Remember to chmod it again when you're finished.

I hope this is what you were after?
Sat 31/05/03 at 16:07
Regular
"Pouch Ape"
Posts: 14,499
I'd look it up myself, but you people are so much help :D

PS, I'll show you why this afternoon sometime!

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

First Class!
I feel that your service on this occasion was absolutely first class - a model of excellence. After this, I hope to stay with Freeola for a long time!
Easy and free service!
I think it's fab that you provide an easy-to-follow service, and even better that it's free...!
Cerrie

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.