title: Warning: mysql_result() expects parameter 1 to be resource, boolean given
body: <p>i know that we already had a lot of question about this error, but i can not fix my code, so anyone here please help me fix this problem.
  my code like this</p>
  
  <pre><code>function login($username, $password) {
      $user_id = user_id_from_username($username);
  
      $username = sanitize ($username);
      $password = md5 ($password);
  
      return (mysql_result(mysql_query("SELECT COUNT (`user_id`) FROM `users` 
          WHERE `username` = '$username' AND `password` = '$password'"),0)==1) ? $user_id : false;
  </code></pre>
  
  <p>i am looking forward to hear from you guys. i am a new member on this so please keep your answer as simple as possible. thank you.</p>