title: Working with PHP functions
body: <p>I have this function that will check if a user already exists in the DB or not:</p>
  
  <pre><code>function checkTwitterAccount($user_id) {
  $accountExists = false;
  $a = "SELECT * FROM twitterAccounts WHERE user_id='".$user_id."'";
  $ar=mysql_query($a) or die("Error selecting twitter account: ".mysql_error());
  $ac = mysql_num_rows($ar); 
  if ($ac &gt; 0) {
  $accountExists = true;
  }
  return $accountExists;
  }
  </code></pre>
  
  <p>Now when I call this function how do I actually know if the user is or is not in the DB?</p>
  
  <p>I mean how do I call this function and how do I check the result?</p>
  
  <p>Is the below right?</p>
  
  <pre><code>If (checkTwitterAccount($user_id) = true) {
  DO THIS
  }else{
  DO THAT
  }
  </code></pre>
  
  <p>Please help me I am new to it.</p>
  
  <p>Thanks</p>