Sayyiduna Abu Hurayrah (may Allah be pleased with him) narrates that the Prophet (peace and blessings be upon him) said: "When any one of you sees someone in some trial (an affliction, illness and the like), let him recite:
'Al-hamdu lillahil-ladhi 'afani mimmabtalaka bih, wa faddalani 'ala kathirin mimman khalaqa tafdila'
(All praise belongs to Allah, who has kept me safe from what He has afflicted you with, and who has greatly favoured me over many of those He created.) The Prophet (peace and blessings be upon him) says: When a person recites these words, he will be counted as one who is grateful for that blessing."
(Allamah al-Haythami says:) I say: Al-Tirmidhi recorded this report in abridged form.
Al-Bazzar recorded it, and al-Tabarani recorded something similar in al-Mu'jam al-Saghir and al-Mu'jam al-Awsat, and its chain is hasan (good).
Hadith Referenceمجمع الزوائد ومنبع الفوائد / كتاب الأذكار / 17138
Hadith Gradingمحدثین:إسنادہ حسن۔
Hadith Takhrij«اخرجه الطبراني فى المعجم الصغير (675) اخرجه البزار فى المسند (3118) ، أخرجه سنن الترمذي برقم: 3431، 3432، وأخرجه البحر الزخار المعروف بمسند البزار 10 - 18 برقم: 9106»
Sayyiduna Abdullah bin Umar (may Allah be pleased with them both) narrates that the Prophet (peace and blessings be upon him) said: "Whoever sees a person afflicted (with a trial, hardship or illness) and recites this supplication: 'Al-hamdu lillahil-ladhi 'afani mimmabtalaka bih, wa faddalani 'ala kathirin mimman khalaqa tafdila'
(All praise belongs to Allah, who has kept me safe from what He has afflicted you with, and who has greatly favoured me over much of His creation.)
The Prophet (peace and blessings be upon him) says: that trial will not befall that person."
Al-Tabarani recorded it in al-Mu'jam al-Awsat; its chain contains a narrator, Zakariyya bin Yahya bin Ayyub al-Darir, whom I do not know, and the remaining narrators of this report are thiqat (trustworthy).
Hadith Referenceمجمع الزوائد ومنبع الفوائد / كتاب الأذكار / 17139