Hi all,
I've just roughly put together a simple PHP script to open a text file and write some variables to it - the file that the vars are written to is meant to be created on the fly and it's filename is created from a unique number extracted from date objects.
<?
$xVals = $xCoords;
$yVals = $yCoords;
$unique = date("YmdHis");
$filename = $unique.".txt";
// chmod ("somefile.txt", 0755);
$handle = fopen($filename, 'w');
$string = $xVals;
$string .= $yVals;
fputs($handle, $string);
fclose($handle);
Print "The data has been written";
?>
Now. Obviously the file doesn't exist so I ger errors - how can I force PHP to create the file, give it the unique name, and then write the variables to it above? I assume I need to CHMOD the file too to allow writing, so I've just commented out the bit I think does that. I've read that PHP will attempt to create a file that doesn't exist, but so far it doesn't work!
Cheers guys.