Thank you for your question.
As the previous doctor mentioned, there are many causes for erectile dysfunction. International guidelines on managing ED as it is called require a thorough investigation of a variety of problems. These include testing for coronary artery disease (as both ED and coronary artery disease are vascular diseases),
thyroid problems,
diabetes, testing for normal testicular and pituitary hormone production and a detailed evaluation of physical, psychological and relationship issues. Many times more than one cause is found and needs treating together with counseling for relationship issues.
Advanced testing is only done in very few centres and usually only done if all other measures and treatments yield no results.
Common medicines for erectile problems can give good results when combined with good sexual practice, pelvic floor exercises and relationship counseling. Often medicines like Viagra are bought over the counter but don't give the results expected or have unpleasant side effects. It is important to remember that even if you take medicines you still need to stimulate the penis and build your arousal to get the quality of erection desired.
You may like to refer to ' Managing erectile dysfunction' by Metz and McCarthy and New Male Sexuality by Bernie Zilbergeld. Also refer to WWW.sexualmed.org and the 'sexuality' portal on Wikipedia for further information related to your query.
hope this clarifies things a little more.