Page 1 of 1

Does anyone know why this doesn't work!

Posted: Sun Feb 01, 2004 6:46 am
by andylyon87
I have this code in a userform:

Code: Select all

function WriteToFile($firstname){
         $TheFile= "$arrayїchat].txt";
         $Open = fopen ($TheFile,"a");
         if($Open){
                   fwrite ($Open,"$firstname");
                   fclose($Open);
                   $Worked=True;
         } else {
           $Worked = False;
          }
          return $Worked;
          }
the specific bit it rejects is

Code: Select all

$TheFile= "$arrayїchat].txt";
why is this and is their any alternative, the array is a randomly generated number.

Posted: Sun Feb 01, 2004 7:38 am
by markl999
Sure you don't mean :

$TheFile = $array['chat'].'.txt';

Posted: Sun Feb 01, 2004 8:11 am
by vigge89
you can also do this:
$TheFile = "{$array['chat']}.txt";