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<
You're not appending your database results to the $accounts string; you're creating it from scratch each time. Try something like this:
<?php
$accounts = "";
$sql = mysql_query("SELECT * FROM _$setprofile ORDER BY fc DESC");
while($row = mysql_fetch_array($sql)) {
$user = $row['user'];
$pass = $row['pass'];
$accounts .= "$user:$pass<br>";
}
//Functionsss!
$file = "backups/$newcode.txt";
file_put_contents($file, $accounts);
echo "<a href=backups/$newcode.txt>TEST!</a>";
?>
so you append it, and then once you've got all your results in the $accounts string, you write it out to the file.