title: Prepare statement fails but no error was returned
body: <p>For some strange reason the preparation of the query fails, I checked ten thousand times and parameters are correct as well as the table. Here is my code:</p>
  
  <pre><code>foreach($decoded as $caption)
  {
  if($stmt = $mysqli-&gt;prepare("SELECT id, leagueCode FROM league"))
  {
      $stmt-&gt;bind_result($id, $leagueCode);
      $stmt-&gt;execute();
      var_dump($stmt);
      while($stmt-&gt;fetch())
      {
          if($leagueCode == $caption['league'])
          {
              if ($stmt = $mysqli-&gt;prepare("INSERT INTO soccerseason (id, caption, league, years, numberOfTeams, numberOfGames, lastUpdated, self, teams, fixtures, leagueTable) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) 
              {
                  $id_fk = $id;
                  $caption = $caption['caption'];
                  $league = $caption['league'];
                  $years = $caption['year'];
                  $not = $caption['numberOfTeams'];
                  $nog = $caption['numberOfGames'];
                  $lu = $caption['lastUpdated'];
                  $self = $caption['_links']['self']['href'];
                  $teams = $caption['_links']['teams']['href'];
                  $fix = $caption['_links']['fixtures']['href'];
                  $lt = $caption['_links']['leagueTable']['href'];
  
                  if ($stmt-&gt;bind_param("isssiisssss", $id_fk, $caption, $league, $years, $not, $nog, $lu, $self, $teams, $fix, $lt)) 
                  {
                      if ($stmt-&gt;execute()) 
                      {
                          echo "Done!";
                      } 
                      else 
                      {
                          die($mysqli-&gt;error);
                      }
                  } 
                  else 
                  {
                      die($mysqli-&gt;error);
                  }
              } 
              else 
              {
  
                  die('execute() failed: ' . $mysqli-&gt;error);
              }
          }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I tried to make a print in the else object but I get only the word </p>
  
  <blockquote>
    <p>execute() failed:</p>
  </blockquote>
  
  <pre><code>else 
  {
      die('execute() failed: ' . $mysqli-&gt;error);
  }
  </code></pre>
  
  <p>and it seems that <code>$mysqli-&gt;error</code> is null because it is not printed, why this happens? What am I doing wrong?</p>