I am quite new to module development although I have experience in modifying existing 6.x block modules developed by others. I have a need to develop a 7.x module and in spite of a lot of documentation reading seem to be missing a basic starting point. I have been looking at the documentation on drupal.org and other third party sites but through my own fault seem to be missing a basic concept.
The site I am working on has a content type called project. At present there are many project pages busing this content type. One of the field types is a User Reference field, called key_contact.
The idea is that I need to create a block that gets the key_contact's username (stored as an id number in the key_contact field) and then from that number perform an SQL query, on another table, to get the id's details and then display them in a block.
At present I have a View that can return the id and I have been asked to replace this view with a module that does the entire job.
Once I get the id for the key_contact I will have no trouble with the SQL query and formatting the output how I want it. I am familiar with creating a block module.
Where I am stuck is understanding how to get the key_contact value from the content type project page when it is loaded.
I would appreciate it if I could either be shown documentation or an example, or even an explanation, that will show me how to extract a field value from a content type like this.