Re: Output of MySQl sorted query to text or Word file.
| From: | Tim Ward | Date: | Fri, 06 Dec 2002 14:17:54 +0000 |
| Subject: | Re: Output of MySQl sorted query to text or Word file. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-127255@lists.php.net to get a copy of this message | ||
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:timward@chessish.com
----- Original Message -----
From: <ed@home.homes2see.com>
To: <php-general@lists.php.net>
Sent: Friday, December 06, 2002 1:25 PM
Subject: [PHP] Output of MySQl sorted query to text or Word file.
>
> I've got a routine that queries a MySQL database and outputs the sorted
> results to a web page (script snippet below.) How can I output the exact
> same thing to a txt file using this script?
>
> <?
>
> $count = 0;
>
> $result = mysql_query ("SELECT * FROM listings ORDER by a
> DESC");
>
> if ($row = mysql_fetch_array($result)) {
>
> do { ?>
>
>
> <? echo $row['company_name']; ?>
>
> <? echo $row['agent_name']; ?>
>
> <? echo $row['county']; ?>
>
> <? echo $row['city']; ?>
> <br>
> <? echo $row['mls']; ?>
>
> $<? echo number_format($row['price'], ","); ?>
>
> <? echo $row['area']; ?>
> <br>
> <? echo $row['copy']; ?>
> <br>
> <? echo $row['agent_name']; ?>
> <p>
>
> <?
> $count++;
>
> if ($count == 8) {
>
> echo "<hr><b>Page Break</b><hr><p>";
> $count = 0;
> }
>
> }
>
> while($row = mysql_fetch_array($result));
>
> mysql_close(); } ?>
>
> Thanks in advance for any ideas
>
> Ed
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>