‘Imrān ibn Husayn (may Allah be pleased with him) reported: I was suffering from hemorrhoids (piles); so I asked the Prophet (may Allah's peace and blessings be upon him) about the prayer and he said: "Pray while standing; if you cannot, then while sitting; and if you cannot, then while lying on your side." Authentic hadith - Narrated by Bukhari