title: PHP Search Not Working When I Get To The While Loop
body: <p>I had a search form for my website which worked perfectly fine, but I then changed my entire login system and it cause a few errors within my site. The only error now that I cant seem to fix is the search forms within my website. Which i thought was weird because the form doesnt use any of the variables from the login form. When I was testing to find out the issue I found out that when the part of my search script gets to the while loop it breaks on me. If you have any suggestions or help it would be much appreciated. I will provide my code below.</p>
  
  <p>hub.php</p>
  
  <pre><code> &lt;?php
  
    // this file connects to the database
    include("includes/connect.inc.php");
  
    session_start();
  
    if (isset($_SESSION['id'])) {
      $uid        = $_SESSION['id'];
    } 
  
  //If the search input was submitted then run
  if(isset($_POST['search'])){
      // turn that the user searched into a varible
      $searchQ = $_POST['search'];
      // delete any symbols for security
      $searchQ = preg_replace("#[^0-9a-z]#i", "", $searchQ);
      // Define varibles before the loop
      $searchArray = array();
      $searchIndex = 0;
  
      // Search through these columns inside the main database
      $searchQuery = mysqli_query("SELECT * FROM database WHERE 
          title   LIKE '%" . mysqli_escape_string( $searchQ ) . "%' 
      ");
  
      // count the number of results
      $searchCount = mysqli_num_rows($searchQuery);
      if($searchCount != 0){
          while($row = mysqli_fetch_array($searchQuery)){
              $titleSearch     = $row['title'];
              $dateSearch      = $row['date'];
  
              // buile the array which will hold all the results
              $searchArray[$searchIndex] = array($titleSearch, $dateSearch);
              $searchIndex++;
          }
      }
  }
  // End of search php
  
  
  
  &lt;form id="search" action="hub.php" method="POST"&gt;
      &lt;div id="searchIcon"&gt;&lt;/div&gt;
      &lt;input type="search" name="search" placeholder="Search"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>here is the connect file | It is used for a bunch of other forms and loops which work fine.</p>
  
  <pre><code>&lt;?php
  
      $host = "MYHOSTINGDOMAIN";
      $username = "MYUSERNAME";
      $password = "MYPASSWORD";
      $db = $username;
  
      $connect = mysqli_connect($host, $username, $password, $db) or die(mysqli_connect_error());
  </code></pre>
  
  <p>I get this error</p>
  
  <blockquote>
    <p>Warning: mysqli_query() expects at least 2 parameters, 1 given in
    /services/webpages/d/i/digitalicon.ca/public/hub.php on line 42</p>
    
    <p>Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result,
    null given in /services/webpages/d/i/digitalicon.ca/public/hub.php on
    line 45</p>
  </blockquote>