The sql command you used is wrong. you have to fetch the complete password as the first part is also part of the password. The encoding that is used is a crypt-md5 encoding with salt as it is used for passwords in linux distributions, e.g. in /etc/passwd too.
The PHP manual describes how to create these passwords:
http://de3.php.net/manual/en/function.crypt.php