Trying to append file with either:
file_put_contents($filename, "
" . $barcode_number.PHP_EOL, FILE_APPEND);
or
$myfile = fopen($filename, 'a+');
neither appending my file. Both are over writing old information
Things I have tried are in code comments
$myfile = fopen($filename, 'a+') or die("unable to open file" . $filename);
$barcode_number = $_POST['SBN'];
//$newLine = PHP_EOL;
//echo $temp.$barcode_number; die();
fwrite($myfile, $barcode_number.PHP_EOL);
fwrite($myfile, "
");
//file_put_contents($filename, "
" . $barcode_number.PHP_EOL, FILE_APPEND);
fclose($myfile);
//echo "wrote " . $barcode_number . "to " . $filename; die();
Expected output is:
123456
123457
123458
actual output is:
123458