Hi
Could any one explain me how to create a text file using php where the records should be from mysql
thanks in advance.
Hi
Could any one explain me how to create a text file using php where the records should be from mysql
thanks in advance.
1) open a file in write mode:
$myFile = "testFile.txt";
$fo = fopen($myFile, 'w') or die("can't open file");
2) Write mysql query and fetch its data
$data_query=mysql_query("SELECT name,age from table");
while($data=mysql_fetch_array($data_query))
$stringData.="Name: ".$data['name']." Age:".$data['age']."\n";
3) Write data into the file
fwrite($fo, $stringData);
4) Close file
fclose($fo);