Jump to content

writing to a text file...


ameriblog

Recommended Posts

i have php script that is working in writing to a file, but i was wanting to customize it a bit better:

 

<?
$file = 'ncaa_ratings.txt';

require ( "dbconnex.php" );

$games_rs = $conn->Execute ( "SELECT * FROM ncaa_gm WHERE game_year = " . $_GET['year'] . " ORDER BY gameID DESC" ) or die ( $conn->ErrorMsg() );

$file= fopen('ncaa_ratings.txt' , 'w');
while ( ! $games_rs->EOF ) {

$txt_output .= THIS IS WHERE I WANT MY INPUT; 
}

fputs($file, $txt_output);
fclose($file);
?> 

 

What I'd like to do is get 4-5 fields from the table and have them in CSV format, so:

 

Field1,Field2,Field3,Field4,Field5

 

 

Link to comment
https://forums.phpfreaks.com/topic/66820-writing-to-a-text-file/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.