$query = "SELECT username, password FROM adminprofile WHERE username='$u' AND password=SHA('$p')";

Just wanted to know what is the function of SHA in the code above. I took this from a book and they don't have an explanation for that particular part. Please help.

Basically, SHA1, md5, password, encrypt, etc are the encrypting functions. If you encrypt a password field, your application will be more secure. That's all.