there are two ways i've seen passwords get 'encrypted'. one is using a hash function like md5:
http://php.net/md5
this is really a 'hash', not encryption. it will take a string as input and output a 32-character string. It's almost impossible to get the original string from the 32-char hash string so in that sense the password is encrypted.
the down side is that you cannot every retrieve the original password from the hash string. you can still use it in a password query though. supposing the field 'password' in the table 'table' contains an md5 hash of the user's original password, you can still check to see if they've entered the password correctly like this;
$sql = "SELECT * FROM table WHERE username='" . $username_from_login_form . "' AND password='" . md5($password_from_login_form) . "'";
If you want two-way encryption, then you need to either write a simple encryption function yourself or use an encryption library like mcrypt. you can read more about that here:
http://us2.php.net/manual/en/function.mcrypt-generic.php