1

I have a php file which adds click track data to a .txt file. Problem is, each time data is added, it's added on the same line, even though I've added the "r\n":

<?php
    $src = isset($_GET['src']) ? $_GET['src'] : "-";
    $dst = isset($_GET['dst']) ? $_GET['dst'] : "-";
    $f = fopen('clickReport.txt',"a+");
    fwrite ($f, date('Y-m-d H:i'));
    fwrite ($f, " : " + $src + " : " + $dst + "\r\n");
    fclose($f);
?>

Text file output:

2014-02-05 01:1702014-02-05 01:1702014-02-05 01:1702014-02-05 01:170

Of course I would like it to be:

2014-02-05 01:170
2014-02-05 01:170
2014-02-05 01:170
2014-02-05 01:170

etc...

Ivan
  • 1,274
  • 16
  • 22

1 Answers1

0

Try replacing this line:

fwrite ($f, " : " + $src + " : " + $dst + " _ " + "\r\n");

with this:

fwrite ($f," : ".$src." : ".$dst." _ "."\r\n");
OfirH
  • 651
  • 1
  • 8
  • 19