You shouldn't hard-code messages like "OK" and "FAIL" into a function as its possible return values, that's a bit scary in terms of localization and the flexibility of your application. You should return a boolean and deal with messages outside of that function.
It makes little sense to test the returned strings if you're calling that function from elsewhere in your application where you only care about the semantics of what has happened as opposed to the returned message. What if you decide to change 'FAIL!' to 'Unsuccessful' for example? You will end up having to change all the other code that relies upon the return of your function. Why not just do something like this:
function InsertIntoDB($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9){
$sql = "INSERT INTO `caches` ( `url` , `username` , `password` , `cachename` , `lat` , `long` , `message` , `notes` , `tags` ) VALUES( '{$field1}' , '{$field2}' , '{$field3}' , '{$field4}' , '{$field5}' , '{$field6}' , '{$field7}' , '{$field8}' , '{$field9}' ) ";
return mysql_query($sql);
}
if(InsertIntoDB(...)) {
echo 'Success!';
} else {
echo 'Fail!';
}
Then somewhere else in your application, you won't need to:
if(InsertIntoDB(...) == 'SUCCESS!') {
...
}
but instead:
if(InsertIntoDB(...)) {
...
}
or:
if(!InsertIntoDB(...)) {
...
}