views:

36

answers:

2

I am having trouble with an update script. It runs for a few hours so I would like it to output live to a text file.

I start the document with

ob_start();

Then within the while loop (as it iterates through the records of the database) I have this

$size=ob_get_length();
if ($size > 0)
{
    $content = ob_get_contents();
    logit($contents);
    ob_clean();
}

And finally the logit function

function logit($data)
{
    file_put_contents('log.txt', $data, FILE_APPEND);
}

However the log file remains empty. What am I doing wrong?

+4  A: 

try

logit($content);
//           ^^ Note the missing s
jigfox
ARGH... such a silly mistake!
Pablo
A: 

$contents is not the same variable as $content

dejavu