Re: Creating a text file
| From: | Ignacio Vazquez-Abrams | Date: | Wed, 17 Jan 2001 18:00:38 +0000 |
| Subject: | Re: Creating a text file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-35088@lists.php.net to get a copy of this message | ||
On Wed, 17 Jan 2001, Wade Halsey wrote:
> Hi
>
> I have the following code in Delphi:
> procedure TFormConfirmAllocation.CreateTxt;
> var TxFile : TextFile;
> Buffer : string;
> x : integer;
> begin
>
> AssignFile(TxFile,'\SkyTrac.sky');
>
>
> Rewrite(TxFile);
>
> with FormConfirmAllocation.Query1 do begin
> open;
> while not Eof do begin
> for x := 0 to fields.Count - 1 do begin
> Buffer := Fields[x].AsString;
> Writeln(TxFile, Buffer);
> end;
> next;
> end;
> end;//with
> CloseFile(TxFile);
> end;
>
> Now I want to create the same sort of thing in Php, could someone please help!
> Thanks
> Wade
> WHalsey@btech.co.za
>
<?php
...
$fp=fopen("/tmp/SkyTrac.sky", "w");
$result=xxx_query(...);
while ($row=xxx_fetch_array($result))
{
while (list($key, $val)=each($row))
{
fputs($fp, $val);
};
};
fclose($fp);
?>
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>