prolly a query that has a NULL entry in it.. like
select from sometable where somefield in ()
note, the () <-- has no values...
my guess.. but if you are logging mysql errors, just look @ the log in your admin control panel (ubbthreads) and it will be more specific
and back to the proper use of 'flock'
a better approach would be to acquire the lock 1st, then truncate and write inside the lock..
example use:
$f=fopen("file", "r+");
flock($f, LOCK_EX) or die("Error! cant lock!");
ftruncate($f, 0);
fwrite($f, $stuff);
fclose($f);
that is thread safe and won't have a small window where the file is erased (truncated) with no exclusivity..