title: Simple php/sql search engine
body: <p>I am trying to make a simple php, sql search engine that will select everything from my database that is "LIKE" the keyword (query) and display it. However it will not work. It only displays the text "problem"(see line 32) and after hours of troubleshooting I still can not figure this out. </p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="UTF-8"&gt;
  &lt;title&gt;Search Engine Test&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;script language="php"&gt;
  // Create a database connection
  $connection = mysql_connect("*****","*****","*****");   
  if (!connection) {
      die ("Please reload page. Database connection failed: " . mysql_error());
  }
  
  // Select a databse to use
  $db_select = mysql_select_db("*****",$connection);
  if (!$db_select) {
      die("Please reload page. Database selection failed: " . mysql_error());
  }
  
  // Search Engine
  // Only execute when button is pressed
  if (isset($_POST['search'])) {
  // Filter
  //$keyword = trim ($keyword);
  echo $keyword;
  // Select statement
  $search = mysql_query("SELECT * FROM tbl_name WHERE cause_name LIKE '%keyword%'");
  // Display
  $result = @mysql_query($search);
  if (!$result){
  echo "problem";
  exit();
  }
  
  
  while($result = mysql_fetch_array( $search )) 
   { 
   echo $result['cause_name']; 
   echo " ";
   echo "&lt;br&gt;"; 
   echo "&lt;br&gt;"; 
   }
   $anymatches=mysql_num_rows($search); 
   if ($anymatches == 0) 
   { 
   echo "Nothing was found that matched your query.&lt;br&gt;&lt;br&gt;"; 
   }
  }
  &lt;/script&gt;
  &lt;form action="&lt;?php echo $_SERVER['PHP_SELF']?&gt;" method="post"&gt;
  &lt;input type="text" name="keyword"&gt;
  &lt;input type="submit" name="search" value="Search"&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>