title: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt,
body: <p>Hi I am in need of some help. I am currently trying to create a search page in which a user is able to search for a specific book by the Title of the book, the category, year and publisher </p>
  
  <p>I have created my basic HTML search form and this is the code below:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=windows-1252"&gt;
      &lt;title&gt;Page Title&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form id ="SearchPage" action="SearchPage.php" method="get"&gt;
  &lt;h1&gt; Search Page&lt;/h1&gt;
  
      Book Title &lt;input type="text" name="bookTitle" /&gt;
  
      Category &lt;select name="catDesc"&gt;
                  &lt;option value = "Business &amp; Commerce"&gt;Business &amp; Commerce&lt;/option&gt;
                  &lt;option value = "Databases"&gt;Databases&lt;/option&gt;
                  &lt;option value = "Databases and Web Development"&gt;Databases and Web Development&lt;/option&gt;
                  &lt;option value = "Fiction"&gt;Fiction&lt;/option&gt;
                  &lt;option value = "Flex &amp; Flash Programming"&gt;Flex &amp; Flash Programming&lt;/option&gt;
                  &lt;option value = "Netorks"&gt;Netorks&lt;/option&gt;
                  &lt;option value = "Programming"&gt;Programming&lt;/option&gt;
                  &lt;option value = "Systems Design"&gt;Systems Design&lt;/option&gt;
                  &lt;option value = "Web Development"&gt;Web Development&lt;/option&gt;
              &lt;/select&gt;
  
  
  
      Publisher &lt;input type="text" name="pubName"/&gt;
  
      Year &lt;input type="text" name="bookYear"/&gt;
  
      &lt;input type ="submit" value-"Find Books"/&gt;
  
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And this is the php code i have done below:</p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=windows-1252"&gt;
      &lt;title&gt;Search Page&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;table&gt;
       &lt;tr&gt;
       &lt;th&gt;Book Title&lt;/th&gt;
       &lt;th&gt;Year&lt;/th&gt;
       &lt;th&gt;Category&lt;/th&gt;
       &lt;th&gt;Publisher&lt;/th&gt;
       &lt;/tr&gt;
  &lt;?php
  
  include 'database_mysqli_conn.php';
  
  $bookTitle = $_REQUEST['bookTitle'];
  $bookYear =$_REQUEST['bookYear'];
  $catDesc =$_REQUEST['catDesc'];
  $pubName =$_REQUEST['pubName'];
  
  $sql = "SELECT bookTitle, bookYear, catDesc, pubName, FROM nbc_book b inner join nbc_category c on b.catID = c.catID inner join nbc_publisher p on b.pubID = p.pubID WHERE 1";
  
  $stmt = mysqli_prepare($conn, $sql);
      mysqli_stmt_execute($stmt);
      mysqli_stmt_bind_result($stmt, $bookTitle, $bookYear, $bookPrice, $catDesc);
  
  if (!empty($bookTitle)) {
  
      $sql= $sql." AND bookTitle = '$bookTitle'";
  
      }
  
  if (!empty($bookYear)) {
  
      $sql= $sql." AND bookYear = '$bookYear'";
  
  }
  
  if (!empty($catDesc)) {
  
      $sql= $sql." AND catDesc = '$catDesc'";
  
  }
  
  if (!empty($pubName)) {
  
      $sql= $sql." AND pubName = '$pubName'";
  
  }
  
  while (mysqli_stmt_fetch($stmt)){
      echo "&lt;tr&gt;
                  &lt;td&gt;$bookTitle&lt;/td&gt;
                  &lt;td&gt;$bookYear&lt;/td&gt;
                  &lt;td&gt;$catDesc&lt;/td&gt;
                  &lt;td&gt;$pubName&lt;/td&gt;
               &lt;/tr&gt;";
  }
  
  mysqli_stmt_close($stmt);
  mysqli_close($conn);
  
  ?&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>the problem is, this is the error message i receive when i submit the search:</p>
  
  <p>Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in /home/unn_w11036829/public_html/PHPexercises/SearchPage.php on line 27</p>
  
  <p>Warning: mysqli_stmt_bind_result() expects parameter 1 to be mysqli_stmt, boolean given in /home/unn_w11036829/public_html/PHPexercises/SearchPage.php on line 28</p>
  
  <p>Warning: mysqli_stmt_fetch() expects parameter 1 to be mysqli_stmt, boolean given in /home/unn_w11036829/public_html/PHPexercises/SearchPage.php on line 54</p>
  
  <p>Warning: mysqli_stmt_close() expects parameter 1 to be mysqli_stmt, boolean given in /home/unn_w11036829/public_html/PHPexercises/SearchPage.php on line 63
  Book Title  Year    Category    Publisher</p>
  
  <p>Can anyone please tell me where i am going wrong! I have been stuck on this for the past hour and its driving me insane.</p>
  
  <p>Thank you in advance </p>