Can I use mysql_result in an if condition in php?
<p>This script works, but it gives a warning if there is no match found:</p>

<pre><code>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
</code></pre>

<p>Is this 'good' php? Or do I have to tackle this another way?</p>

<p>Goal of the script: If there is a user with that mail, give its ID</p>
