Jump to content

Recommended Posts

Okay, this PHP code i'm using in the register part and the part of code that counts users dosen't work (It resets the number of users to 1)
[code]
$file=@fopen"_private/num_of_users.txt","r" or die"Sorry profile couldn't be created";
    $num_users=@fread($file,filesize($file));
    
    $num_users=$num_users+1;
    @fclose$file;
    
    $file=@fopen"_private/num_of_users.txt","w+" or die"Sorry profile couldn't be created";
    @fwrite$file,$num_users;
    @fclose($file);
        
    
    $file=@fopen$newfilename2,"w+";
    @fwrite$file,$num_users;
    @fclose$file;
[/code]
I know I don't have () in the functions
Please help
Link to comment
https://forums.phpfreaks.com/topic/11600-php-code-error/
Share on other sites

[!--quoteo(post=381999:date=Jun 9 2006, 12:53 PM:name=Orio)--][div class=\'quotetop\']QUOTE(Orio @ Jun 9 2006, 12:53 PM) [snapback]381999[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Tried adding () ...?
I think it's the only problem.

Orio.
[/quote]
No i took out the () so the forums would let post code

EDIT: I found the problem in the fread part the second argument wasn't the right file.
Link to comment
https://forums.phpfreaks.com/topic/11600-php-code-error/#findComment-43786
Share on other sites

[!--quoteo(post=382004:date=Jun 9 2006, 12:08 PM:name=Fyorl)--][div class=\'quotetop\']QUOTE(Fyorl @ Jun 9 2006, 12:08 PM) [snapback]382004[/snapback][/div][div class=\'quotemain\'][!--quotec--]
use file_get_contents instead of fopen, fread... and why are you writing to a new file at the bottom?
[/quote]
file_get_contents was added as of PHP 4.30..

Anyways, he fixed it [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]
Link to comment
https://forums.phpfreaks.com/topic/11600-php-code-error/#findComment-43789
Share on other sites

[!--quoteo(post=382005:date=Jun 9 2006, 02:09 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 9 2006, 02:09 PM) [snapback]382005[/snapback][/div][div class=\'quotemain\'][!--quotec--]
file_get_contents was added as of PHP 4.30..

Anyways, he fixed it [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]
[/quote]
A lot of functions were added as of PHP 4, doesn't mean we should only use PHP 3 functions...
Link to comment
https://forums.phpfreaks.com/topic/11600-php-code-error/#findComment-43792
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.