Try this..<BR>
<BR>
<span style="color: rgb(102, 102, 102);">if (db_fetch_object(db
</span><span style="color: rgb(102, 102, 102);">_query(db_rewrite_sql("SELECT COUNT(*) FROM {files} f WHERE f.filepath LIKE 'files/%'", 'f'))) &gt;= 1) {
</span><BR>
<BR>
 <BR>
<BR>
<span style="font-weight: bold;">On Mon Apr 23 10:45 , 'Johan Forngren' <johan@forngren.com> sent:<BR>
<BR>
</johan@forngren.com></span><blockquote style="border-left: 2px solid rgb(245, 245, 245); margin-left: 5px; margin-right: 0px; padding-left: 5px; padding-right: 0px;">Hi all,<BR>
<BR>
I need help with turning this query into something useful<BR>
<BR>
SELECT fid FROM {files} WHERE filepath LIKE 'files/%' LIMIT 1<BR>
<BR>
<span style="color: rgb(102, 102, 102);">if (count(db_fetch_object(db
</span><span style="color: rgb(102, 102, 102);">_query("SELECT fid FROM {files} WHERE filepath LIKE 'files/%' LIMIT 1"))) == 1) {
</span><BR>
<BR>
The purpose is to determine if there is some files within the dir 'files' registered in the db. I'm stuck at the db_* stuff, any help would be greatly appreciated. See also <a href="http://drupal.org/node/98824" target="_blank" defanged_onclick="return top.js.OpenExtLink(window,event,this)">

http://drupal.org/node/98824</a> .<BR>
<BR>
Thank you<br clear="all"><BR>
-- <BR>
Regards,<BR>
&nbsp;&nbsp;Johan Forngren <BR>
<BR>
&nbsp;&nbsp;<a href="javascript:top.opencompose('johan@forngren.com','','','')" target="_blank" defanged_onclick="return top.js.OpenExtLink(window,event,this)">
johan@forngren.com</a> :: <a href="http://johan.forngren.com/" target="_blank" defanged_onclick="return top.js.OpenExtLink(window,event,this)">http://johan.forngren.com/
</a>
</blockquote><BR>