title: Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in
body: <p>struggling with my web design assignment. I've been following a tutorial to add in a search feature for my website, but I've been getting the following error:</p>
  
  <p>Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /search.php on line 31</p>
  
  <p>line 31 is (or was)</p>
  
  <pre><code>&lt;pre&gt;if(mysqli_num_rows($results) &gt;= 1)&lt;/pre&gt;
  </code></pre>
  
  <p>That was the original error. as per instructions in the comments, I've since revised the code:</p>
  
  <pre><code>&lt;pre&gt;
  
  
  
      &lt;?php
  
  //capture search term and remove spaces at its both ends if the is any
  $searchTerm = trim($_GET['keyword']);
  
  //check whether the name parsed is empty
  if($searchTerm == "")
  {
      echo "Enter the name/brand of what you're looking for.";
      exit();
  }
  
  //database connection info
  $host = "localhost";
  $db_name = "sookehhh_shopsy_db";
  $username = "sookehhh_shopsy";
  $password = "xxxx";
  
  
  
  //connecting to server and creating link to database
  $link = mysqli_connect($host, $username, $password, $db_name) or die('Could not connect: ' . mysqli_connect_error());
  
  //MYSQL search statement
  $query = "SELECT * FROM sookehhh_shopsy_db WHERE name LIKE '%" . mysqli_real_escape_string($link, $searchTerm)  . "%'";
  
  // original query$query = "SELECT * FROM sookehhh_shopsy_db WHERE name LIKE '%$searchTerm%'";
  
  $results = mysqli_query($link, $query);
  
  //added suggestion below - not sure if correct place?
  if (!$result) {
      die(mysqli_error($link)); 
  }
  
  /* check whethere there were matching records in the table
  by counting the number of results returned */
  if(mysqli_num_rows($results) &gt;= 1)
  {
      $output = "";
      while($row = mysqli_fetch_array($results))
      {
          $output .= "Product Name: " . $row['name'] . "&lt;br /&gt;";
          $output .= "Price: " . $row['price'] . "&lt;br /&gt;";
      }
      echo $output;
  }
  else
      echo "There was no matching record for that item " . $searchTerm;
  ?&gt;
  &lt;/pre&gt;
  </code></pre>
  
  <p>made necessary changes and updated yet again - </p>
  
  <p>now the only error message I'm getting here is "Table 'sookehhh_shopsy_db.sookehhh_shopsy_db' doesn't exist"</p>
  
  <p>I'm assuming that I need to change the username, perhaps because it's too similar?</p>
  
  <p>Anywho, thanks for your help so far, and I apologise for my complete ignorance.</p>
  
  <p>I've been trying to teach myself, but unfortunately time is a luxury I just don't have at the moment.</p>