The purpose of my lab is to have the user search through a database called "pageVistis" from what they enter in the field. They can search through the remote host or page name. I have Been having trouble fixing an error that i am recieving saying "Notice: Undefined variable: searchtype in C:\xampp\htdocs\pageVisitsLab\DataBC.php on line 23
Fatal error: Uncaught Error: Call to a member function bind_param() on boolean in C:\xampp\htdocs\pageVisitsLab\DataBC.php:25 Stack trace: #0 {main} thrown in C:\xampp\htdocs\pageVisitsLab\DataBC.php on line 25". Also the code is form a file called "DataBC.php". If any extra information is needed please let me know and i will edit this post and include it thank you.
include "interface.php";
if(isset($_POST['submit'])) {
    $sName = $_POST['sN'];
    $sHost = trim($_POST['sH']);
  if(!$sName || ! $sHost) {
      echo "<p> Please enter a search </p>";
      exit;
  }
  /*switch ($sName) {
      case 'sName':
      case 'sHost':
          break;
      default:
          echo  "<p> Invalid search type and please try again </p>";
  }
 */
 $query = "SELECT page_name, visit_date, previous_page, request_method, remote_host, remote_port FROM visitInfo 
            WHERE $searchtype= ?";
   $stmt = $databse -> prepare($query);
   $stmt-> bind_param('s',$sName);
$stmt-> execute();
 $stmt->store_result();
  $stmt->bind_result($pageName,$visitDate,$previouPage,$requestMethod,$remoteHost,$remotePort);
  echo "<p> The number of items found: .$stmt->num_rows</p>";
  while ($stmt->fetch()) {
      echo  "<p><strong>page Name: ".$pageName."</strong></p>";
      echo "Visit Date: ".$visitDate."<br>";
      echo  "Previous Page: ".$previouPage. "<br>";
      echo  " Request Method: ".$requestMethod. "<br>";
      echo  "Remote Host: ".$remoteHost. "<br>";
      echo "Remote Port: ".$remotePort. "<br>";
  }
  $stmt->free_result();
  $databse->close();
 }
?>
 
    