function openDb() {
global $linkID;
$linkID = @mysql_connect( 'localhost', USER, PASSWORD ) or die("cannot connect to db because " . mysql_error());
mysql_select_db( DATABASE, $linkID ) or die("cannot select db because " . mysql_error());
}
if( !( $fp = fopen( "http or a local file", "r or w or a" ))) {
print( "File could not be opened." );
}
while( !feof( $fp ) ) {
// read a line from the file
$myLine = fgets( $fp );
print( $myLine . "
\n" );
}
fputs( $fp, "Hello World!" );
fclose( $fp );