PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
It' s a problem with the character encoding in your database and the one that Notepad uses. For example you may use utf-8 in your database and the Notepad uses ANSI. Use the rtf or html format.
You have to use beside Line feed \n Carriege Return i.e. \r and because of the mode that Microsoft set new lines that was astions referring to.
<?php
include "config.php";
$id = (isset($_GET['id'])) ? intval($_GET['id']) : 0;
if(!empty($id)){
$result = mysql_query('SELECT `id`, `page`, `header`, `date`, `content`, `contador` FROM `webapp`');
$filename = "$id.txt";
// Push headers that tell what kind of file is coming down the pike
header('Content-type: text/plain');
header('Content-Disposition: attachment; filename='.$filename);
$content=$row['content'] . (strlen($row['content']) < 256 )? str_repeat('\n',256-$total):''; // Fix annoying IE bug
$total = strlen($row['content']);
header('Content-length: '.$total);
echo $content;
} else {
die('Unknown File');
}
?>
How are you getting from mysql $result to the $row array? That would be a major reason why there is nothing other than the new line problems every one else has pointed out!
Still what problem - too many newlines or nothing between the new lines?
Have you changed the code to fill $row array? If so post it so we can help you!!! Hint mysql_fetch_assoc() is quite good at doing that when combined with a while loop.