It is narrated from Sayyiduna Ka'b bin Malik (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "Whoever seeks knowledge for one of these three things: to argue with the foolish, or to boast before the scholars, or to draw people's attention towards himself" - and about this he (peace and blessings be upon him) spoke words of severe warning.
Hadith Referenceالمعجم الكبير للطبراني / باب الكاف / 16249