title: What does the output of PHP function 'mysqli_prepare' mean
body: <p>I am new to PHP and prepared SQL sentences and I got one question when reading the documentation.</p>
  
  <p>Function <a href="http://php.net/manual/en/mysqli.prepare.php" rel="nofollow noreferrer">'mysqli.prepare'</a> returns a boolean value when executed. According to the documentation:</p>
  
  <blockquote>
    <p><code>mysqli_prepare()</code> returns a statement object or FALSE if an error occurred.</p>
  </blockquote>
  
  <p>That's not a very detailed description of the returned value. I mean, when does it exactly fail? Only when the SQL syntax is not correct? Or when we try to execute it and it does not work for any other reason (I base this last supposition on the example shown on the documentation, where almost all the script is enclosed in an <code>if</code> statement)</p>
  
  <p>Based on this, I also have a second question: is it a good practice to run <code>mysqli_prepare()</code> together with an <code>if</code>? Or should the <code>if</code> statement be written when we run the <code>$stmt-&gt;execute();</code> function later on?</p>