I had a look at that earlier, but couldn't work out how to apply it to the above.
--------------- Added [DATE]1342899536[/DATE] at [TIME]1342899536[/TIME] ---------------
Ok one last question, i notice that the <div class="attachment"></div> appears even if nothing matches via the query, this gives a small grey box. I cannot do a conditional because i cannot use {vb:raw var} what should i use in place? I tried some various options in the PHP and the template, but i couldn't get any working.