Errors in File Handling program

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!

Moderator: General Moderators

User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Errors in File Handling program

Post by jackpf »

I don't know...your code looks like a big jumble tbh.

Find wherever you're writing to the file, and either put that in the loop, or concatenate a string to write to the file.
phphunger
Forum Commoner
Posts: 45
Joined: Tue Aug 11, 2009 11:56 pm

Re: Errors in File Handling program

Post by phphunger »

jackpf thanks for ur support, actually i missed the append mode in the fileWrite(), now my task is fulfilled, thanks mate

Code: Select all

function fileWrite($export)
{
            
            $myFile = "phonedetails.txt";
            $fh = fopen($myFile, 'a') or die("can't open file");
            
            $stringData = "$export";
            fwrite($fh, $stringData);
            fclose($fh);
 
}
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Errors in File Handling program

Post by jackpf »

Cool, nice one.
Post Reply