title: Warning: Invalid argument supplied for foreach() HTML embedded
body: <p>I have made a basic search engine and I try, to fetch the results, on the same page; moreover, the results have been retrieved and stored in the associative array, but the embedded code in HTML shows only one record, of the results. `</p>
  
  <pre><code>&lt;?php
  require('Configuration/config.php');
  require('Configuration/db.php');
  
  
  
  //If the user clicks, on the button search, the execute the query
  if (isset($_POST['search_btn'])) {
      $search_query = $_POST['search'];
      //$search_query = htmlspecialchars($_POST['search']);
      //Create the query.
      $query = "SELECT * FROM The_primary_arkivum WHERE 
      Name = '$search_query' OR 
      Address = '$search_query' OR 
      Category = '$search_query' OR
      Country = '$search_query' OR
      State = '$search_query'";
  
      //Get the results.
      $results = mysqli_query($conn, $query);
  
      //Fetch the data, of the result, to an array.
      $search_results = mysqli_fetch_all($results, MYSQLI_ASSOC);
      //var_dump($search_results);
      //var_dump($search_query);
  
      //Free result
      mysqli_free_result($results);
      //Close the connection
      mysqli_close($conn);
  }
  ?&gt;
  
  &lt;?php include('included/header.php'); ?&gt;
      &lt;body&gt;
          &lt;div class = "header"&gt;
              &lt;h2&gt;Search&lt;/h2&gt;
          &lt;/div&gt;
  
          &lt;form method="post" action="search_index.php"&gt;
              &lt;div class="input-group"&gt;
                &lt;label&gt;Search&lt;/label&gt;
                &lt;input type="text" name="search" value="&lt;?php echo $search; ?&gt;"&gt;
              &lt;/div&gt;
  
              &lt;div class="input-group"&gt;
                &lt;button type="submit" class="btn" name="search_btn"&gt;Search&lt;/button&gt;
              &lt;/div&gt;
  
              &lt;?php foreach($search_results as $search_result) : ?&gt;
              &lt;div class="mySlides fade"&gt;
                &lt;?php echo $search_result['Name']?&gt;
                &lt;?php echo $search_result['Address']?&gt;
                &lt;?php echo $search_result['Country']?&gt;
              &lt;/div&gt;
              &lt;?php endforeach; ?&gt;
          &lt;/form&gt;
  &lt;?php include('included/footer.php'); ?&gt;
  </code></pre>
  
  <p>`</p>