This script works, but it gives a warning if there is no match found:
if (...)
    irrelevant...
elseif ($userId = mysql_result(
                     mysql_query("SELECT id FROM users WHERE mail = 'jhon@doe.com'")
                             , 0))
    echo $userId;
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 4
Is this 'good' php? Or do I have to tackle this another way?
Goal of the script: If there is a user with that mail, give its ID
 
     
    