...

View Full Version : File Operations



ygrouk
04-12-2003, 10:53 PM
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.


$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

x_goose_x
04-12-2003, 11:01 PM
http://www.php.net/manual/en/function.file-exists.php



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum