additionally, MySQL also has a password() function, but it's one-way. You can't decrypt an encrypted string, but you can match against it, like this:
mysql_query("INSERT INTO login (id, password) VALUES ('$id', PASSWORD('$password'))";
and then to compare and retrieve, something like this:
mysql_query("SELECT * FROM login WHERE id='$id' AND password=PASSWORD('$password')");