$result = mysqli_query($link, "SELECT * FROM `table`");
while($result_show = mysqli_fetch_array($result)){
$symbol = $result_show['symbol'];
$data = '
Перменная1: '.$symbol.'
';
file_put_contents($file, $data);
echo $data;
}
file_put_contents($file, $data, FILE_APPEND);