Adding variables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ChessclubFriend
Forum Newbie
Posts: 21
Joined: Sun Mar 25, 2007 9:13 pm

Adding variables

Post by ChessclubFriend »

How do I do,

$votes=fopen("votes.txt", "r");

where inside votes.txt is just the number 1.

and then,

$votes++;

so that $votes becomes 2. When I do $votes++ it messes up
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

fopen() returns a file resource to be used be other related functions. See file_get_contents().
ChessclubFriend
Forum Newbie
Posts: 21
Joined: Sun Mar 25, 2007 9:13 pm

Post by ChessclubFriend »

Thank you very much!
Post Reply