I am trying to pull data from SQL, and then write it to a text file. This does that, to an extent, but it only pulls 1 from the table, which reads test:test<
test:test<
file_put_contents overwrites the existing file. With the above code, you'll only ever get one line.
Try this instead:
"; $content .= $accounts; } $file = "backups/$newcode.txt"; file_put_contents($file, $content); echo "TEST!"; ?>