Im a PHP newbie. I am creating a jobs website and my search function tells me when there is no result but if there is, it displays ALL the jobs I have entered on the database. Please assist, I have tried everything.
here is my code:
 <?php
    if(isset($_POST['submit']))
   {
      $search = $_POST['keyword'];
      $query = "SELECT * FROM jobs WHERE job_tags LIKE '%$search%'";
      $search_query = mysqli_query($connection, $query);
      if(!$search_query) {
        die ("query failed" . mysqli_error($connection));
      }
      $count = mysqli_num_rows($search_query);
    if($count == 0){
        echo "<h3> NO RESULT</h3>";
    }else{
    $query = "SELECT * FROM jobs"; 
    $job_display = mysqli_query($connection, $query);
    while($row = mysqli_fetch_assoc($job_display)){
        $job_title = $row['job_title'];
        $employer = $row['employer'];
        $job_date = $row['job_date'];
        $job_logo = $row['job_logo'];
        $job_desc = $row['job_desc'];
?>
<div class="row">
    <div>
                <div class="media img-responsive">
                    <div class="media-left media-middle">
                        <a href="#">
                        <img class="media-object" src="images/<?php echo $job_logo; ?>" class="img-responsive" alt="Absa Insurance Logo">
                        </a>
                     </div>
                        <div class="media-body">
                        <h4 class="media-heading"><span class="job-tittle"><?php echo "{$job_title}";?> </span>(<i class="glyphicon glyphicon-map-marker"> </i>Gauteng, <span class="type blue"> Short-Term Insurance</span>)</h4>
                        <P>
                        <?php echo $job_desc;?>  
                        ...<a href="details.html"> <i class="glyphicon glyphicon-plus"> </i> Read More</a></P>
                    </div>
                        <div class=" media-right media-middle job-location">
                       <p> <?php echo $job_date;?> </p>
                        </div>
                </div>
    </div>
</div>
                        <?php } 
                                    }
                            }
?>
here is the Form
 <form class=" form-inline" action="search.php" method="post">
                            <div class="form-group">
                                <input type="text" name="keyword" class="form-control" placeholder="Job Key Word">
                            </div>
                            </form>
Please let me know if you need more information.
 
     
    