Your issue is Mysql syntax related, not hashes related.
Good practice would looks like this:
$password = md5($password.$global_salt.$_COOKIE['LALA_ID']);
$password = mysql_real_escape_string($password);
$lala_id = mysql_real_escape_string($_COOKIE['LALA_ID']);
$query = "SELECT emails_password,emails_id FROM lala.in_emails
WHERE emails_password ='$password'
AND emails_id='$lala_id'";
$result = mysql_query($query) or trigger_error(mysql_error().$query);
if(mysql_num_rows($result)>0){echo "same pass";}
Thanks to Stephane and Imre L for their great comments, made this code better
Addendum:
People in comments accused me for using escaping on MD5() function result.
I feel it's good point to be explained for the future readers:
If you think of data source of every particular variable - you're mixing layers.
MD5() do not do any "sanitization". It's just a coincidence that it's result contain no special characters.
But one shouldn't think of this at all!
Database layer should be independent from context. It must be totally abstract. No matter how you validate your data - MD5, only latin letters, digits' etc - all this has nothing to do with database layer. DB layer should know noting of data source and form. It should just perform it's duty of making SQL of correct syntax. One day validation rule may change - for the plain password, or for some binary format may contain null byte, etc. Validation rules may change but database rules must remain the same.
Take prepared statements as an example:
Do you decide for the each variable, does it need binding or not? Nope - you're doing it unconditionally, for the every variable, no matter of it's form. So, escaping for the data in quotes should be.