Pulling data from SQL, and writing to a text file

前端 未结 7 1145
广开言路
广开言路 2021-01-07 01:28

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<

7条回答
  •  梦毁少年i
    2021-01-07 01:54

    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!";
    ?>
    

提交回复
热议问题