title: return (mysql_result(mysql_query("SELECT COUNT('ID') FROM 'users' WHERE 'username' = '$username'") , 0) == 1) ? true : false;
body: <pre><code>function user_exists($username)
  {
      $username = sanitize($username);
      //query = ;
      return (mysql_result(mysql_query("SELECT COUNT('ID') FROM 'users' WHERE 'username' = '$username'") , 0) == 1) ? true : false;
  }
  </code></pre>
  
  <p>This code gives the error:</p>
  
  <pre><code>Warning: mysql_result() expects parameter 1 to be resource, boolean given in C:\Users\James\Desktop\Container\XAMPP\htdocs\Triiline1\login.php on line 23
  </code></pre>
  
  <p>I've looked around and the other questions fixing this don't seem to fix my problem.</p>
  
  <p>I am also confused as to the end of the line: <code>? true : false;</code>
  I got that code from a phpacademy tutorial on youtube, and I can't find documentation on it anywhere. I suspect it may be outdated?</p>