title: Creating a php search from Mysql database
body: <p>I am building a bus reservation system using php &amp; mysql.
  In here I am trying to input the search field "route" which is fields of the mysql table. 
  It seems to have problem in searching and printing the results to the page. Please help me out. </p>
  
  <pre><code>&lt;?php 
  $connect=mysqli_connect("localhost","root","","tsms");
  $output ='';
  if(isset($_POST['from'])){
      $searchq = $_POST['from'];
      $query = mysqli_query("SELECT * FROM bus WHERE route='$serchq' ");
      $count = mysqli_num_rows($query);
      if($count==0){
          echo "&lt;script&gt;
  alert('No bus services are found');
  &lt;/script&gt;"; 
      } else {
          while($row = mysqli_fetch_array($query)){
              $imageData = $row['image'];
              $arrival = $row['arrival_time'];
              $departure = $row['departure_time'];
              $type = $row['bus_type'];
              $class = $row['class'];
              $name = $row['bus_name'];
              $facilities = $row['facilities'];
              $reservation = $row['reservation_fee'];
              $output = '&lt;div&gt;'.$arrival.''.$departure.''.$type.''.$class.''.$name.''.$facilities.''.$reservation.'&lt;/div&gt;';
          }
      }
  }
  echo $output;
  ?&gt;
  </code></pre>