Praise be to Allah, and peace and blessings be upon the Messenger of Allah and his family.
This du’a “Alhamdullilah alladhi la yuhmadu ‘ala makruhin siwah” was not narrated from the Prophet (peace and blessings of Allah be upon him). What was narrated from the Prophet (peace and blessings of Allah be upon him) is that which was narrated by Ibn Majah (3803) from ‘Aishah who said: “When the Messenger of Allah (peace and blessings of Allah be upon him) saw something that he liked, he would say, ‘Al-hamdu Lillah alladhi bi ni’matihi tatimm ul-salihat (Praise be to Allah by Whose blessing good things happen).’ And if he saw something that he disliked he would say, ‘alhamdulillah ‘ala kulli hal’ (praise be to Allah in all circumstances).’” (Classed as hasan by al-Albani in Sahih Ibn Majah)
Shaykh Ibn ‘Uthaymin (may Allah have mercy on him) said in Tafsir Juz ‘Amma (p. 127):
“With regard to what some people say, “Praise be to Allah besides Whom no one can be praised for that which is disliked”, this is contrary to that which is taught in the Sunnah. Rather you should say what the Prophet (peace and blessings of Allah be upon him) said: “Al-hamdu Lillahi 'ala kulli haal (praise be to Allah in all circumstances).” If you say, “Praise be to Allah besides Whom no one can be praised for that which is disliked”, then you are in fact announcing that you dislike what Allah has decreed for you, and this is not appropriate. Rather what you should do is to bear with patience that which Allah has decreed for you, whether you like it or not, because the One Who has decreed it is Allah, may He be glorified. He is your Lord and you are His slave; He is your Owner and you belong to Him. If Allah is the One Who has decreed for you something that you dislike, then do not panic, rather you must be patient and not get angry, whether you keep that in your heart or you express it in your words and physical actions.
Be patient and put up with it, because circumstances change and nothing in this world lasts forever. The Prophet (peace and blessings of Allah be upon him) said: “Know that victory comes with patience, and that ease comes with difficulties, and that with hardship there is relief.” (Classed as sahih by al-Albani in Tahqiq al-Sunnah li Ibn Abi ‘Asim, 315)
Allah is to be praised in all circumstances, at times of both ease and hardship, because if He decrees a time of ease, it is a test and a trial. Allah says (interpretation of the meaning):
“and We shall make a trial of you with evil and with good.” [al-Anbiya 21:35]
If something bad happens to you, then bear it with patience, for that is also a test and a trial from Allah, to see whether you will be patient or not. If you are patient and seek reward from Allah, then Allah says (interpretation of the meaning):
“Only those who are patient shall receive their reward in full, without reckoning.” [al-Zumar 39:10]”
For more, please see these answers: 263376 , 107258 and 146025 .
And Allah knows best.