Random error?

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
sn0re
Forum Newbie
Posts: 3
Joined: Mon Feb 21, 2011 6:30 pm

Random error?

Post by sn0re »

I've pretty new to PHP, but i'm currently using this code

Code: Select all

<?php
$user = $_GET['user'];
$userfile = "users/" + $user + ".txt";
$fh = fopen($userFile, 'w+');
$numdiamonds = fread($fh, filesize($userFile));
$intdiamonds = (int)$numdiamonds;
$newdiamonds = $numdiamonds + 1;
fwrite($fh, $newdiamonds);
fclose($fh);
?>
and i'm just getting this error: Image
Any ideas? I have a file called sn0re.txt in the /users/ folder, and it has the number 0 in it. Also, my website that this is on is located at http://diamonds.net78.net/
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Random error?

Post by Weirdan »

string concatenation operator is . (dot), not +
sn0re
Forum Newbie
Posts: 3
Joined: Mon Feb 21, 2011 6:30 pm

Re: Random error?

Post by sn0re »

So it should be $userfile = "users/".$user.".txt";
instead?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Random error?

Post by John Cartwright »

sn0re wrote:So it should be $userfile = "users/".$user.".txt";
instead?
Try it
sn0re
Forum Newbie
Posts: 3
Joined: Mon Feb 21, 2011 6:30 pm

Re: Random error?

Post by sn0re »

It's just that my web host takes FOREVER to upload and PHP dosen't work on my computer.
EDIT:

Code: Select all

$userfile = "users/".$user.".txt";
dosen't work either :(
Post Reply