title: sql response with ajax filter not working
body: <p>My first contact with ajax. I have modify <a href="http://www.w3schools.com/php/php_ajax_database.asp" rel="nofollow">this</a> tutorial. However sql response is always not showing any record. 
  I made var_dump of $result, but only got bool(false). 
  Where I made mistake? Is any better way of making dynamic filters?</p>
  
  <p>My function, simple table:</p>
  
  <pre><code>function showRoadMap() {
  $conn.... //cut connection with database
  
  $q = $_GET['q'];
  $sql = "SELECT * FROM roadmap WHERE status={$q}";
  $result = $conn-&gt;query($sql);
  
      if ($result-&gt;num_rows &gt; 0) {
          echo '
          &lt;table class="showGrid"&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Name&lt;/td&gt;
                      &lt;td&gt;Status&lt;/td&gt;
                  &lt;/tr&gt;';
          while($row = $result-&gt;fetch_assoc()) {
  
              echo '&lt;tr&gt;&lt;td&gt;'.$row['name'].'&lt;/a&gt;&lt;/td&gt;
                    &lt;td&gt;'.$row['status'].'&lt;/td&gt;&lt;/tr&gt;';
          }
          echo '&lt;/table&gt;';
      }
      else
          echo 'No record found';
      }
  }
  </code></pre>
  
  <p>My php file:</p>
  
  <pre><code>&lt;script&gt;
  function showFilter(str) {
  if (str == "") {
      document.getElementById("txtHint").innerHTML = "";
      return;
  } else { 
      if (window.XMLHttpRequest) {
          // code for IE7+, Firefox, Chrome, Opera, Safari
          xmlhttp = new XMLHttpRequest();
      } else {
          // code for IE6, IE5
          xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      xmlhttp.onreadystatechange = function() {
          if (xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) {
              document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
          }
      }
      xmlhttp.open("GET","roadmapShow.php?q="+str,true);
      xmlhttp.send();
  }
  }
  &lt;/script&gt;
  &lt;form&gt;
  &lt;select name="status" onchange="showFilter(this.value)"&gt;
  &lt;option value=""&gt;Select a status:&lt;/option&gt;
  &lt;option value="proposal"&gt;proposal&lt;/option&gt;
  &lt;option value="approved"&gt;approved&lt;/option&gt;
  &lt;option value="done"&gt;done&lt;/option&gt;
  &lt;option value="refuse"&gt;refuse&lt;/option&gt;
  &lt;/select&gt;
  &lt;/form&gt;
  &lt;div id="txtHint"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>and the last file: roadMapShow.php</p>
  
  <pre><code>&lt;?php showRoadMap(); ?&gt;
  </code></pre>