View Single Post
  #2  
Old 12-07-2005, 05:59 AM
maddy maddy is offline
OSP Starters
 
Join Date: Dec 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
maddy is on a distinguished road
Default Remedy for php script errors

All these errors are being caused by the 1st one.
if file_get_contents fails then fopen is going to fail then fputs will fail and then fclose will fail.. what you need to do is make some simple error handling methods. Error seems to be saying the file your trying to open doesnt exist.

Try Out This::
PHP Code:
if (isset($_GET['data'])) {
$filename = 'test.txt';
if (file_exsits($filename)) {

$file_data = file_get_contents($filename);
$file_data = str_replace($somecontent, "", $file_data);
$file = fopen($filename, "w");
fputs($file, $file_data);
fclose($file);

}
} -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
  Webmaster Forums - View Single Post - Errors with php script
View Single Post
  #2  
Old 12-07-2005, 05:59 AM
maddy maddy is offline
OSP Starters
 
Join Date: Dec 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
maddy is on a distinguished road
Default Remedy for php script errors

All these errors are being caused by the 1st one.
if file_get_contents fails then fopen is going to fail then fputs will fail and then fclose will fail.. what you need to do is make some simple error handling methods. Error seems to be saying the file your trying to open doesnt exist.

Try Out This::
PHP Code:
if (isset($_GET['data'])) {
$filename = 'test.txt';
if (file_exsits($filename)) {

$file_data = file_get_contents($filename);
$file_data = str_replace($somecontent, "", $file_data);
$file = fopen($filename, "w");
fputs($file, $file_data);
fclose($file);

}
} -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote