There is no need for manual queries.
You can load a file using file_load($fid)file_load($fid)
, and then the path is is in $file->uri$file->uri
. MightIt might look a bit stringe ('public://something.jpg'), but that's a so called stream wrapper, and it works just fine with plain PHP file functions.
It's not exactly clear to me what you are trying to achieve,achieve; if you want to render an image field from a node/user/..., there are better ways to embed title and things like that, but this would work if you really just have a field. (That you are trying to query the field data table suggests otherwise, though).)
<?php
$file = file_load($fid);
$variables = array(
'path' => $file->uri,
'style_name' => 'your_style_name',
);
print theme('image_style', $variables);
?>