Sunan Ibn Majah, Book 34, Hadith 17 (In-Book) ⓘ
It was narrated from Jabir that : the Messenger of Allah said: "Ask Allah for beneficial knowledge and seek refuge with Allah from knowledge that is of no benefit."
حَدَّثَنَا عَلِيُّ بْنُ مُحَمَّدٍ، حَدَّثَنَا وَكِيعٌ، عَنْ أُسَامَةَ بْنِ زَيْدٍ، عَنْ مُحَمَّدِ بْنِ الْمُنْكَدِرِ، عَنْ جَابِرٍ، قَالَ قَالَ رَسُولُ اللَّهِ ـ صلى الله عليه وسلم ـ " سَلُوا اللَّهَ عِلْمًا نَافِعًا وَتَعَوَّذُوا بِاللَّهِ مِنْ عِلْمٍ لاَ يَنْفَعُ " .
also referenced under: Hadith 3843 (Reference) & Volume 5, Book 34, Hadith 3843 (DarusSalam)