Pulling data from SQL, and writing to a text file

前端 未结 7 1094
广开言路
广开言路 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条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-07 01:54

    It looks like you are reopening and rewriting the entire contents of the file with every pass through your while loop.

    Try this:

    ";
    
      fwrite($fh, $accounts);
    }
    
    fclose($fh);
    
    echo "TEST!";
    ?>
    

    Also, if you don't want the < br >, but a real line break, use:

      $accounts = "$user:$pass\n";
    

提交回复
热议问题