|
Posted by Andrew @ Rockface on 07/01/05 09:25
In news:VO4xe.81320$gc6.55013@okepread04,
Kees Boer <keesboer@integrity-computing.net> wrote:
> Hi, does someone know of a language translater that translates COBOL
> or XBase languages into PHP?
>
> A lot of times, I know how to do something in other languages, but I
> have a hard time finding the commands in PHP, while looking through
> the tutorials. It will tell me all sorts of stuff that is
> interesting, but not what I want to know.
>
> What I mean is this for instance.
>
> I am looking for a way to do this in PHP after I've done the query and
> gotten all of the records into a recordset.
>
> Go to top of file.
> Do while not EOF
> Read Record
> Process Record
> Skip to next Record
> End do.
Do you still use COBOL? I haven't even seen any code written in it since my
college days :) I guess you still need to put specific characters in
specific columns. A weird-ass language, but as you say, it's file handling
was pretty good.
Anyway, assuming you're talking about a text file:
http://uk.php.net/manual/en/function.file.php
$lines = file('filename');
foreach ($lines as $line_num => $line) {
process line...
}
OR:
http://uk.php.net/manual/en/function.fopen.php
$fh = fopen('filename', 'r');
while(! feof($fh)) {
process line...
}
fclose($fh);
> This is very standard data processing, but I'm having a hard time
> finding the commands in PHP tutorials for going to the top of the
> recordset. Testing to see whether one is at the end of the recordset
> and skipping to the next record.
>
> Maybe PHP doesn't work like that and I'm just stuck into the old ways
> of doing things.
>
> Kees
--
Andrew @ Rockface
np: Blind Blake - Police Dog Blues
www.rockface-records.co.uk
Navigation:
[Reply to this message]
|