title: Search method using PHP MYSQL
body: <p>I'm trying to use search as my retrieve option, this is my simpliest form of searching, what can I do with these codes, No error but not working. Please indicate what is wrong in my code. Give advice, site, solution Thanks.</p>
  
  <pre><code>    &lt;?php
      error_reporting(E_ALL); 
      ini_set('display_errors', 1);
      session_start();
      ob_start();
  
  //connetion database
      $dbhost = '192.168.0.9';
      $dbuser = 'dsc';
      $dbpass = 'csd';
  
      $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('ERROR CONNECTING TO MYSQL');
  
      $dbname = 'dbtips';
      mysql_select_db($dbname);
  
      $output='';
  
      if(isset($_POST['search']))
      {
          $searchq = $_POST['search'];
          $searchq = preg_replace("#[^0-9a-z]#i","",$searchq);
  
  //query
          $query = mysql_query("SELECT * FROM tblnews WHERE udate LIKE '%$searchq%'");
          $count = mysql_num_rows($query);
  
          if($count==0)
          {
              $output = 'There was no search result!';
          }
          else
          {
              while($row = mysql_fetch_array($query)){
                     $udate = $row['udate'];
                     $mis = $row['mis'];
                     $status = $row['status'];
  
  
  
                     $output .= '-&gt;'.$udate.'-'.$mis.'-'.$status.'&lt;br&gt;'; 
      }
      }
      }
      ?&gt;      
  
      //form for searching
      &lt;form action="search.php" method="POST"&gt;
      &lt;center&gt;
      &lt;p&gt;
      &lt;input type="text" size="90" name="search" style="text-align:center"&gt;
      &lt;br&gt;
      &lt;br&gt;
      &lt;input type="button" name="searchbutton" value="Search"&gt;
      &lt;br&gt;
      &lt;br&gt;
      &lt;/p&gt;
      &lt;/center&gt;
      &lt;/form&gt;
  </code></pre>