title: Basic Search using the WHERE clause mysql_query and mysql_fetch_array
body: <p>I am fairly new to PHP and mysql and was wondering if I could get some help with my code for searching my database and returning the results.
  <code></p>
  
  <pre><code>&lt;?php
  $con = mysql_connect("localhost", "root", "");
  if (!$con) {
      die ("could not connect to db");
  }
  
  if (!mysql_select_db("site", $con)) {
      die ("Could not connect to table");
  }
  
  $search = $_POST["text"];
  $result = mysql_query("SELECT * FROM torrents WHERE name ='$search'"); //or LIKE instead of =
  
  while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
      echo $row['name']; 
  }
  
  ?&gt;
  </code></pre>
  
  <p></code></p>
  
  <p>Any help is appreciated. Right now the code works error free but has no output. open to all changes and advice.</p>