If you do not know PHP - I doubt any examples are going to help, dealing with SQL and the like is a bit further down the track. I would suggest you learn PHP as best you can before dealing with vBulletin.
You would put the query inside the function prepare_output. You would not put it in "$this->block_data['mymodification']" as that should contain the html to output. You would do the query as Hanson suggestion, then get the results and put it in the block_data.
I never said that, im a noob in php. I can write scripts and i have dealt with using databases before. I just need an example on how to do it with vbulletin, and it's weird template system.