Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: File Operations

  1. #1
    New Coder
    Join Date
    Mar 2003
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    File Operations

    Hi Guys

    please could you tell me if i can check (using PHP) if a file already exists. If the file does exist just carry on to add the data. And if the file does not exist it will create it then carry to add the data. Please find below the php i have written to write to the file.

    PHP Code:
    $fp=fopen("/usr/local/psa/home/vhosts/gameygro.com/httpdocs/data/gamecount/$QUERY_STRING.txt","r");
    $count fgets($fp,1024);
    fclose($fp);
    $fw=fopen("/usr/local/psa/home/vhosts/gameygro.com/httpdocs/data/gamecount/$QUERY_STRING.txt","w");
    $cnew $count+1;
    $countnew fputs($fw,$count+1);
    echo 
    "$cnew";
    fclose($fw); 
    Cheers
    Pete

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Montreal, Canada
    Posts
    644
    Thanks
    0
    Thanked 0 Times in 0 Posts


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •