02-01-2010, 09:02 PM
|
#1 (permalink)
|
|
The Acquainted
Join Date: Feb 2008
Posts: 107
Thanks: 3
|
Write Mysql results to a text file
Hello mates, I need help about writing mysql results to a text file. I stuck in this code, it only write "array" to a text file.
PHP Code:
$myFile = "test.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
function data_dump( $query ) {
$results = mysql_query( $query );
$data = array();
while ( $row = @mysql_fetch_assoc( $results ) )
$data[] = $row;
return $data;
}
$stringData = data_dump( $query )."\n";
fwrite($fh, $stringData);
fclose($fh);
|
|
|