I'm pretty new at using fwrite and file_put_contents and am getting errors on every line of my for loop statement:
Warning: file_put_contents() expects parameter 1 to be string,
or
Warning: fwrite(): 3 is not a valid stream resource in...
This is the code:
$databank = "data.txt"; $access = fopen($databank, 'w')or die("cant open file"); fclose($access);
$row = "$ent1".' | '."$ent2".' | '."$perc1a".'% | '."$perc1a_frac".'% | '."$frac1a".' | '."$perc2a".'% | '."$perc2a_frac".'% | '."$frac2a".' | +'."$a".' | '."$new_ent1".' | '."$perc1b".'% | '."$perc1b_frac".'% | '."$frac1b".' | '."$perc2b".'% | '."$perc2b_frac".'% | '."$frac2b".' \n';
fwrite($access, $row);
//file_put_contents($access,$row);
I have a hunch its a string related issue. Any pointers in greatly appreciated.