title: Can't get prepared statements in PHP to work with MySQL
body: <p>In the <code>mysql</code> console I have this</p>
  
  <pre class="lang-sql prettyprint-override"><code>mysql&gt; SELECT `name`, `lastname` FROM `tblStudents` WHERE `idStudent`='2';
  +--------------+-----------------+
  |     name     |    lastname     |
  +--------------+-----------------+
  |     Lucio    |    Martínez     |
  +--------------+-----------------+
  1 row in set (0.00 sec)
  </code></pre>
  
  <p>So I want to get the name and last name of this student using prepared statements in PHP. </p>
  
  <p>This is the code:</p>
  
  <pre class="lang-php prettyprint-override"><code>$mysqli = $this-&gt;ConnectLowPrivileges();
  echo 'Connected&lt;br&gt;';
  $stmt = $mysqli-&gt;prepare("SELECT `name`, `lastname` FROM `tblStudents` WHERE `idStudent`=?");
  if (false==$stmt){
      die('prepare() failed: ' . htmlspecialchars($mysqli-&gt;error));
  }
  $id = 2;
  if ($rc = $stmt-&gt;execute(array($id))){
      if ($row = $stmt-&gt;fetch()){
          echo "Name: {$row[0]}.&lt;br&gt;Last name: {$row[1]}.&lt;br&gt;";
          echo 'Another way:'.print_r($row);
      }
  }
  if (false==$rc){
      die('execute() failed: ' . htmlspecialchars($stmt-&gt;error));
  }
  echo 'done';
  mysqli_close($mysqli);
  return true;
  </code></pre>
  
  <p>The second conditional gives false and the output that I get is this:</p>
  
  <pre><code>Connected
  execute() failed: 
  </code></pre>
  
  <p>PHP is make the connection with the database without problems.</p>
  
  <p>I can't know the exact error because <code>$stmt-&gt;error</code> returns nothing.</p>