On Fri, 6 Dec 2002, Tim Ward wrote:

> everything you need is here
> 
> http://www.php.net/manual/en/ref.filesystem.php
> 
> in particular fopen(), fputs(), fwrite(), etc.
> 
> Tim Ward
> http://www.chessish.com
> mailto:[EMAIL PROTECTED]


 I found all this and have worked on getting the file output and formated
to my (actually my boss') liking. The text file gets formatted just fine
when read in Linux but the newlines appear as blocks when viewing in
Windows. I've included the scipt that reads and formats the output below.
What do I need to use to create real linefeeds or new lines when viewing
under windows?

TIA,

Ed

<?

include ("../global.php");

mysql_connect ($host, $user, $pass);

mysql_select_db ($database);

$count = 0;

$fp = fopen("$ad_path/example.txt", "w");
$newline = "\n";
$space = " ";
$dollar = "\$";
$ln = "-----------";
$br = "Page Break";

$result = mysql_query ("SELECT * FROM listings ORDER by area, price
DESC");

if ($row = mysql_fetch_array($result)) {

do {

fputs($fp, $row['mls']);
fputs($fp, $space);
fputs($fp, $dollar);
fputs($fp, number_format($row['price'], ","));
fputs($fp, $space);
fputs($fp, $row['area']);
fputs($fp, $newline);
fputs($fp, $row['copy']);
fputs($fp, $newline);
fputs($fp, $newline);

$count++;

if ($count == 8) {

fputs($fp, $ln);
fputs($fp, $br);
fputs($fp, $ln);
fputs($fp, $nl);
fputs($fp, $nl);

$count = 0;

}

}

while($row = mysql_fetch_array($result));

mysql_close();

fclose($fp);

}

?>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to