title: PHP, ajax, xml, jQuery - Dynamic search only returns one value
body: <p>I'm trying to implement a dynamic search function in html, jQuery, ajax and php.
  The problem is that the search function only does the search when you have entered 2-3 letters.
  E.g: When pressing letter "f" it should return every row in database which contains the letter "f". The return <strong>data</strong> is empty.(It should return 20 values, i've tested the query)
  Right now it only returns a result when writing "foo", maybe it's because the that is the only row which have the name. This time it returns the xml structure:</p>
  
  <pre><code>&lt;picture&gt;
     &lt;picuser&gt;CorrcetUser&lt;/picuser&gt;
     &lt;picurl&gt;CorrectURL&lt;/picurl&gt; 
     &lt;pictime&gt;CorrectTime&lt;/pictime&gt;
     &lt;picid&gt;CorrectID&lt;/picid&gt;
     &lt;comment&gt;
          &lt;commenttime&gt;Foo&lt;/commenttime&gt;
          &lt;commentuser&gt;Foo&lt;/commentuser&gt;
          &lt;commenttext&gt;Foo&lt;/commenttext&gt;
     &lt;/comment&gt;
     &lt;description&gt;
           Foo bar
     &lt;/description&gt;  
  &lt;/picture&gt;
  </code></pre>
  
  <p>Here is the code right now:</p>
  
  <p>the javascript file</p>
  
  <pre><code>$(document).ready(function() {
  
    $(".search").keyup(function() {
        var searchbox = $(this).val(); // get the string in the searchbox
        var dataString = 'searchword=' + searchbox;
        if (searchbox == '') {
  
        } else {
          $.ajax({
              type : "POST",
              url : "search.php",
              data : dataString,
              dataType : "xml",
              async: false,
              cache : false,
              success : function(data, textStatus, jqXHR) {
                                  //Data repsonse from server
                                  console.log(data);  
              },
              error: function (jqXHR, textStatus, errorThrown)
              {
           
              }
           });
        }
     });
  }); 
  </code></pre>
  
  <p>Here is the search.php</p>
  
  <pre><code>&lt;?php
  include ('dbconnect.inc.php');
  
  if ($_POST) {
  echo '&lt;?xml version="1.0" standalone="no"?&gt;';
  
  
  $searchword = $_POST['searchword'];
  $sql = "SELECT * FROM picture WHERE description LIKE :searchword";
  $query = $dbh -&gt; prepare($sql);
  $query -&gt; execute(array('searchword' =&gt; '%' . $searchword . '%'));
  $nr=0;
  $outputXML ="";
  $results = $query-&gt;fetchAll(PDO::FETCH_ASSOC);
  
  foreach($results as $row) {
  
      $outputUser =  $row['userName'];
      $outputPicURL = $row['picURL'];
      $outputTime = date('Y-m-d H:i',  $row['time']); 
      $outputString = $row['description'];    
      $outputPicID = $row['pictureID'];   
  
      $outputXML.= "&lt;picture&gt;
                  &lt;picuser&gt;$outputUser&lt;/picuser&gt;
                  &lt;picurl&gt;$outputPicURL&lt;/picurl&gt; 
                  &lt;pictime&gt;$outputTime&lt;/pictime&gt;
                  &lt;picid&gt;$outputPicID&lt;/picid&gt;
                  &lt;comment&gt;
                      &lt;commenttime&gt;Foo&lt;/commenttime&gt;
                      &lt;commentuser&gt;Foo&lt;/commentuser&gt;
                      &lt;commenttext&gt;Bar&lt;/commenttext&gt;
                  &lt;/comment&gt;
              &lt;description&gt;
                  Foo bar
              &lt;/description&gt;  
          &lt;/picture&gt;";
  
   }
   echo $outputXML;
  }
  
  
  ?&gt;
  </code></pre>
  
  <p>I thought this was an easy fix, but here I'm stuck.
  And wondering why <strong>data</strong> is empty?</p>