$fp = fopen ('/home/myplace/public_html/Runstats-2007-01-01.txt', 'a');
$fp = fopen ('/home/myplace/public_html/Runstats-2007-01-02.txt', 'a');
$fp = fopen ('/home/myplace/public_html/Runstats-2007-01-03.txt', 'a');

I'd like to stick a changing date into the fopen comand. I've tried some different subs with $xx
but the fopen keeps reading it wrong.
I think the prob is in the representation of the ',' between the two.

$fp = fopen( $name , $mode);

Help!

    Um, what exactly did you try?

    All your examples so far look okay, assuming the variables $name and $mode are defined correctly.

      $name = "'/home/myplace/public_html/Runstats-2006-07-13.txt'";
      $fp = fopen ($name , 'a');

      Warning: fopen('/home/myplace/public_html/Runstats-2006-07-13.txt') [function.fopen]: failed to open stream: No such file or directory in /home/eleme6/public_html/scgi-bin/lm10sm.php on line 53

      one of many... also tried
      $fp fopen ($name , $fc) with $fc ="'a'";

        $name = "/home/myplace/public_html/Runstats-2006-07-13.txt";
        

        Too many quotes. Either use a set of single quotes, or a set of double quotes, not both.

          Weedpacket wrote:

          ... with $fc ="'a'";
          Ditto.

          Ok... I'll go try it. But it would seem that that would result in

          $fp = fopen (/home/myplace/public_html/Runstats-2007-01-01.txt, a);

            kansaschuck wrote:

            Ok... I'll go try it. But it would seem that that would result in
            $fp = fopen (/home/myplace/public_html/Runstats-2007-01-01.txt, a);

            I think you're looking at variables wrong... PHP doesn't literally replace $var with its contents in your source code... it just pulls data from $var and uses it.

              Write a Reply...