Sunan Ibn Majah, Book 5, Hadith 1269 (In-Book) ⓘ
It was narrated that ‘Abdullah said: “The Messenger of Allah said: ‘If anyone of you is uncertain about his prayer, let him try to do what is correct then let him prostrate twice.’” Tanafisi said: "This is the basic rule, and no one is able to reject it."
حَدَّثَنَا عَلِيُّ بْنُ مُحَمَّدٍ، حَدَّثَنَا وَكِيعٌ، عَنْ مِسْعَرٍ، عَنْ مَنْصُورٍ، عَنْ إِبْرَاهِيمَ، عَنْ عَلْقَمَةَ، عَنْ عَبْدِ اللَّهِ، قَالَ قَالَ رَسُولُ اللَّهِ ـ صلى الله عليه وسلم ـ " إِذَا شَكَّ أَحَدُكُمْ فِي الصَّلاَةِ فَلْيَتَحَرَّ الصَّوَابَ ثُمَّ يَسْجُدْ سَجْدَتَيْنِ " . قَالَ الطَّنَافِسِيُّ هَذَا الأَصْلُ وَلاَ يَقْدِرُ أَحَدٌ يَرُدُّهُ .
also referenced under: Hadith 1212 (Reference) & Volume 2, Book 5, Hadith 1212 (DarusSalam)