> The problem is when the query does not succeed it outputs this:
> 
> Warning: fclose(): supplied argument is not a valid stream 
> resource in c:\php\www\test-scripts\index.php on line 42
> 
> is there any way to "block" just this warning while keeping 
> all other error handling as is?

Yes, the error control operator (@).

<?php @fclose( $fp ); ?>

Reference: http://www.php.net/manual/en/language.operators.errorcontrol.php

Though as another poster pointed out, adding some checking would be a better
approach.  You could simply test to see whether it is a resource, or even go
so far as to check that it's a file resource.

<?php
if( is_resource( $fp ) && get_resource_type( $fp ) == "file" ) {
  fclose( $fp );
}
?>

Cheers,

Rick

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to