title: Echo specific row from mysql database, within set of range
body: <p>I tried to echo rows from mysql database. So in my code user can enter a value, and then program echoes table around the entered value. That part of the code works fine, but when I tried to echo entered values and corresponding row to the value, it somehow gave me first row. While I needed exact row, which I previously entered.
  Here is my code:</p>
  
  <pre><code>$density = $_POST["density"];
  $t = $_POST["t"];
  $query = $pdo-&gt;prepare ("SELECT * FROM mytable WHERE " 
      ."(Density &gt;= '$density'-0.05 AND Density &lt;='$density' +0.05) AND "
      ."(Temp &gt;='$t' -2 AND Temp &lt;='$t' +2) ");
  if (!$query-&gt;rowCount() == 0) {
  $query -&gt; execute();
  while ($results = $query-&gt;fetch(PDO::FETCH_ASSOC)){
  echo "&lt;table&gt;";
  echo "&lt;tr&gt;&lt;td&gt;";            
              echo $results['Temperature'];
                  echo "&lt;/td&gt;&lt;td"&gt;";
              echo $results['Density'];
                  echo "&lt;/td&gt;&lt;td&gt;";
              echo $results['DensityValues'] + $delden;
  
              echo "&lt;/td&gt;&lt;/tr&gt;";
  
                              echo "&lt;/table&gt;";
          }
    }
  </code></pre>
  
  <p>So currently it prints the first row which is: Temp=>10, Density=>600, DensityValues=>658;
  While I need to get values I have enterd and coresponding density value: Temp=>12, Density=>650, DensityValues=>678;</p>