title: Checking for values in table (phpmyadmin, php, mysql), only returns a 0
body: <p>I'm trying to make a page that looks if the text you enter exists in the table in my database. But it's only returning a 0, even if it exists.</p>
  
  <pre><code>&lt;?php
      $db = mysql_connect("database", "user", "password") or die("Could not connect to MySQL. ".MySQL_error());
      mysql_select_db("myData",$db);
  ?&gt;
  &lt;form method = "POST" action = "website.php"&gt;
  &lt;input type = "text" name = "text"&gt;
  &lt;input type = "submit" name = "button1" value = "check"&gt;
  &lt;/form&gt;
  &lt;?php
      if(isset($_POST["button1"])) {
          $txt = $_POST['text'];
          $sql = mysql_query("SELECT COUNT(*) as total FROM myText WHERE text = $txt");
          $quantity = mysql_fetch_assoc($sql);
          echo $quantity['total'];
      }
  ?&gt;
  </code></pre>