Could be Erectile Dysfunction caused by loss of blood flow to the penis. ED can also be caused by other health problems such as; High blood pressure, High cholesterol, diabetes or nervous system disorders.
Painful erection could be due to a number of causes. A common cause is phimosis or a tight foreskin which may warrant circumcision. Other causes include peyronie's disease,priapism,lichen sclerosis et obliterans etc. The underlying cause must be evaluated clinically and treated accordingly.
Stone in penile urethra, Growth [ca] in penile urethra, phimosis or paraphimosis, infection anywhere in urinary tract, any past injury in corpora cavernosa or corpus spongiosum, injury on glans penis, post gonorrheal stricture of urethra, injured glans, perineal injury - these are most common causes. See your urologist immediately.
It is a very uncommon condition. It could be caused by a number of issues from injury sustained to the area to irregular blood flow. It could also be from plaque build up or a cystic mass. This should be checked by a doctor immediately.