title: Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\kurinchi\kkmalar.php on line 41
body: <p>I cannot find out what's wrong in this code. Since the query executes and insert also works but the error msg shows:</p>
  
  <p>Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\kurinchi\kkmalar.php on line 41</p>
  
  <pre><code>$q = intval($_GET['q']);
  $availability = isset($_GET['availability']);
  $con = mysqli_connect('localhost','root','','kurinchi');
  
  if (!$con) {
      die('Could not connect: ' . mysqli_error($con));
  }
  
  mysqli_select_db($con,"ajax_demo");
  $sql="UPDATE rooms SET availability=(availability-1) WHERE ID = (SELECT ID from (SELECT * from rooms WHERE ID = '".$q."')AS innerResult)" ;
  $result = mysqli_query($con,$sql);
  
  if($result === FALSE) { 
      die(mysql_error()); 
  }
  
  echo "&lt;table&gt;
  &lt;tr&gt;
      &lt;th&gt;ROOM TYPE&lt;/th&gt;
      &lt;th&gt;AC TYPE&lt;/th&gt;
      &lt;th&gt;PRICE&lt;/th&gt;
      &lt;th&gt;AVAILABILITY&lt;/th&gt;
      &lt;th&gt;BOOK &lt;/th&gt;
  &lt;/tr&gt;";
  
  while($row = mysqli_fetch_array($result)) {
      echo "&lt;tr&gt;";
      echo "&lt;td&gt;" . $row['room_type'] . "&lt;/td&gt;";
      echo "&lt;td&gt;" . $row['ac_type'] . "&lt;/td&gt;";
      echo "&lt;td&gt;" . $row['price'] . "&lt;/td&gt;";
      echo "&lt;td&gt;" . $row['availability'] . "&lt;/td&gt;";
      echo "&lt;td&gt;" . $row['booking_status'] . "&lt;/td&gt;";
      echo "&lt;/tr&gt;";
  }
  
  echo "&lt;/table&gt;";
  mysqli_close($con);
  </code></pre>