title: PHP errors -> Warning: mysqli_stmt::execute(): Couldn't fetch mysqli_stmt | Warning: mysqli_stmt::close()
body: <p>I keep getting this error while trying to modify some tables. Here's my code:   </p>
  
  <pre><code>/**  &lt;- line 320
   *
   * @param array $guests_array
   * @param array $tickets_array
   * @param integer $seat_count
   * @param integer $order_count
   * @param integer $guest_count
   */
  private function book_guests($guests_array, $tickets_array, &amp;$seat_count, 
          &amp;$order_count, &amp;$guest_count){
  /* @var $guests_array ArrayObject */
      $sucess = false;
      if(sizeof($guests_array) &gt;= 1){
          //$this-&gt;mysqli-&gt;autocommit(FALSE);
          //insert the guests into guest, person, order, seat
          $menu_stmt = $this-&gt;mysqli-&gt;prepare("SELECT id FROM menu WHERE
                      name=?");
          $menu_stmt-&gt;bind_param('s',$menu);
          //$menu_stmt-&gt;bind_result($menu_id);
  
          $table_stmt = $this-&gt;mysqli-&gt;prepare("SELECT id FROM tables WHERE
                      name=?");
          $table_stmt-&gt;bind_param('s',$table);
          //$table_stmt-&gt;bind_result($table_id);
  
          $seat_stmt = $this-&gt;mysqli-&gt;prepare("SELECT id FROM seat WHERE
                      name=? AND table_id=?");
          $seat_stmt-&gt;bind_param('ss',$seat, $table_id);
          //$seat_stmt-&gt;bind_result($seat_id);
          for($i=0;$i&lt;sizeof($guests_array);$i++){
  
              $menu = $guests_array[$i]['menu'];
              $table = $guests_array[$i]['table'];
              $seat = $guests_array[$i]['seat'];
  
              //get menu id
              if($menu_stmt-&gt;execute()){
                  $menu_stmt-&gt;bind_result($menu_id);
                  while($menu_stmt-&gt;fetch())
                          ;
              }
              $menu_stmt-&gt;close();
  
              //get table id
              if($table_stmt-&gt;execute()){
                  $table_stmt-&gt;bind_result($table_id);
                  while($table_stmt-&gt;fetch())
                          ;
              }
              $table_stmt-&gt;close();
  
              //get seat id
              if($seat_stmt-&gt;execute()){
                  $seat_stmt-&gt;bind_result($seat_id);
                  while($seat_stmt-&gt;fetch())
                          ;
              }
              $seat_stmt-&gt;close();
  
              $dob = $this-&gt;create_date($guests_array[$i]['dob_day'],
                      $guests_array[$i]['dob_month'],
                      $guests_array[$i]['dob_year']);
              $id = $this-&gt;add_person($guests_array[$i]['first_name'],
                      $guests_array[$i]['surname'], $dob,
                      $guests_array[$i]['sex']);
  
              if(is_string($id)){
                  $seat = $this-&gt;add_seat($table_id, $seat_id, $id);
                  /* @var $tickets_array ArrayObject */
                  $guest = $this-&gt;add_guest($id,$tickets_array[$i+1],$menu_id,
                          $this-&gt;volunteer_id);
                  /* @var $order integer */
                  $order = $this-&gt;add_order($this-&gt;volunteer_id, $table_id,
                          $seat_id, $id);
  
                  if($guest == 1 &amp;&amp; $seat == 1 &amp;&amp; $order == 1){
                      $seat_count += $seat;
                      $guest_count += $guest;
                      $order_count += $order;
  
                      $success = true;
                  }
              }
          }
      }
      return $success;
  } &lt;- line 406
  </code></pre>
  
  <p>Here are the warnings:</p>
  
  <pre><code>The person PRSN10500000LZPH has been added to the guest tablePRSN10500000LZPH added to table (1), seat (1)The order for person(PRSN10500000LZPH) is registered with volunteer (PRSN10500000LZPH) at table (1) and seat (1)PRSN10600000LZPH added to table (1), seat (13)The person PRSN10600000LZPH has been added to the guest tableThe order for person(PRSN10600000LZPH) is registered with volunteer (PRSN10500000LZPH) at table (1) and seat (13) Warning: mysqli_stmt::execute(): Couldn't fetch mysqli_stmt in /Users/olatunjigbadamosi/Sites/ST_Ambulance/FormDB.php on line 358 Warning: mysqli_stmt::close(): Couldn't fetch mysqli_stmt in /Users/olatunjigbadamosi/Sites/ST_Ambulance/FormDB.php on line 363 Warning: mysqli_stmt::execute(): Couldn't fetch mysqli_stmt in /Users/olatunjigbadamosi/Sites/ST_Ambulance/FormDB.php on line 366 Warning: mysqli_stmt::close(): Couldn't fetch mysqli_stmt in /Users/olatunjigbadamosi/Sites/ST_Ambulance/FormDB.php on line 371 Warning: mysqli_stmt::execute(): Couldn't fetch mysqli_stmt in /Users/olatunjigbadamosi/Sites/ST_Ambulance/FormDB.php on line 374 Warning: mysqli_stmt::close(): Couldn't fetch mysqli_stmt in /Users/olatunjigbadamosi/Sites/ST_Ambulance/FormDB.php on line 379 PRSN10700000LZPH added to table (1), seat (13)The person PRSN10700000LZPH has been added to the guest tableThe order for person(PRSN10700000LZPH) is registered with volunteer (PRSN10500000LZPH) at table (1) and seat (13) Warning: mysqli_stmt::execute(): Couldn't fetch mysqli_stmt in /Users/olatunjigbadamosi/Sites/ST_Ambulance/FormDB.php on line 358 Warning: mysqli_stmt::close(): Couldn't fetch mysqli_stmt in /Users/olatunjigbadamosi/Sites/ST_Ambulance/FormDB.php on line 363 Warning: mysqli_stmt::execute(): Couldn't fetch mysqli_stmt in /Users/olatunjigbadamosi/Sites/ST_Ambulance/FormDB.php on line 366 Warning: mysqli_stmt::close(): Couldn't fetch mysqli_stmt in /Users/olatunjigbadamosi/Sites/ST_Ambulance/FormDB.php on line 371 Warning: mysqli_stmt::execute(): Couldn't fetch mysqli_stmt in /Users/olatunjigbadamosi/Sites/ST_Ambulance/FormDB.php on line 374 Warning: mysqli_stmt::close(): Couldn't fetch mysqli_stmt in /Users/olatunjigbadamosi/Sites/ST_Ambulance/FormDB.php on line 379 PRSN10800000LZPH added to table (1), seat (13)The person PRSN10800000LZPH has been added to the guest tableThe order for person(PRSN10800000LZPH) is registered with volunteer (PRSN10500000LZPH) at table (1) and seat (13)
  </code></pre>