Hi,
I have written a script that give information from db and try to dump them on file-system.
For saving info i have this function:
function private_writefile($filename,$data){
$Handle = fopen($filename, 'w');
if (fwrite($Handle, $data)===false){
exit('WRITE PROBLEM IN '.$filename);
}
fflush($Handle);
fclose($Handle);
chmod($filename,0777);
}
It works some times. But not always,
It saves:
page0.gr - 66kb
471203.gr - 19kb
471203_images0.gr - 19kb
471203_articles.gr - 0kb
take a look at last one! It is 0kb mean than fwrite didn't work! And it isnt the only problem. Script will end after this file! Showing me a blank screen!
Funny but it works with same data on my pc, But not on server.
If i add a line to replace data with some thing static. Maybe like this:
function private_writefile($filename,$data){
[COLOR="Red"]$data='BAD DATA! BUT AT LAST CAN SAVE IT';[/COLOR]
$Handle = fopen($filename, 'w');
if (fwrite($Handle, $data)===false){
exit('WRITE PROBLEM IN '.$filename);
}
fflush($Handle);
fclose($Handle);
chmod($filename,0777);
}
then it works! Writing "BAD DATA! BUT AT LAST CAN SAVE IT" in all files.
Any one know why?! Is there any other function to write data?!
tnx! I am confused right now so sorry for english!