Narrated Abu Hurayrah (RA): The Prophet (peace be upon him) said: If anyone acquires knowledge that should be sought seeking the Face of Allah, but he acquires it only to get some worldly advantage, he will not experience the arf, i.e. the fragrance, of Paradise.
Sunan Abi Dawud, Book 26, Hadith 24





