i am new to the programming world and i am working on a app with search feature. my problem is that the following code is not able to output the search data from the database. I am using require_once command to plug my database connection for this output via header.php.
Please help.
<!DOCTYPE html>
 <html lang=""> 
 <?php require_once('Include/Top.php');?>
<body>
  <?php require_once('Include/header.php'); ?>
<centre>
            <div class="searchboxsearch">
                <div class="row">
                    <div class="col-xs-12">
                       <br><br><br><br>
                        <form action="" method="get">
                        <div class="form-group">
                                <input type="text" id="usermame" class="form-control" name="username" placeholder="Search a Name">
                        </div>
                        <input type="submit" name="submit" class="btn btn-primary" value="Search"> 
                        </form>
                    </div>
                </div>
            </div>                 
                    <?php 
                    
                    $sname = $_GET['username'];
                    $terms = explode(" ", $sname);
                    
                    
                    foreach ($terms as $each)
                    {
                        $i++;
                        if ($i == 1)
                            $query .= "keywords LIKE '%$each%'";
                        else 
                            $query .= "keywords LIKE '%$each%'";
                    }   
                    $query = "SELECT * FROM feedback WHERE $query";
                    $srun = mysqli_query($connection, $query);
                       if (mysqli_num_rows($srun) > 0)
                          {
                               while($row = mysqli_fetch_assoc($srun))
                               {
                                   $name =ucfirst($row['fullname']);
                                   $date =$row['date']; 
                                    $feedback = $row['feedback'];
                                    
                                    echo "<h3> $name</a></h3>
                                    $feedback <br /> $stdate";
                                }
                           
                       }else 
                          {
                               echo " No result found";
                           }
            ?>
</centre>
<?php require_once('Include/footer.php'); ?>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</body>
</html>Thankyou
KP
 
     
    