title: MaterializeCSS Autocomplete PHP MySQL
body: <p>I need to make a autocomplete input in materialize css page,</p>
  <p>I've tried this code but did not work. Do you have any idea how to make this possible?</p>
  <p>From here <a href="https://www.codexworld.com/autocomplete-textbox-using-jquery-php-mysql/" rel="nofollow noreferrer">Autocomplete Textbox using jQuery, PHP and MySQL</a></p>
  <p><strong>index.php</strong></p>
  <pre class="lang-html prettyprint-override"><code>  &lt;link rel=&quot;stylesheet&quot; href=&quot;//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css&quot;&gt;
    &lt;script src=&quot;//code.jquery.com/jquery-1.10.2.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;//code.jquery.com/ui/1.11.4/jquery-ui.js&quot;&gt;&lt;/script&gt;
    &lt;script&gt;
    $(function() {
      $( &quot;#skills&quot; ).autocomplete({
        source: 'search.php'
      });
    });
    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div class=&quot;ui-widget&quot;&gt;
      &lt;label for=&quot;skills&quot;&gt;Skills: &lt;/label&gt;
      &lt;input id=&quot;skills&quot; type=&quot;text&quot;&gt;
    &lt;/div&gt;
  </code></pre>
  <p><strong>search.php</strong></p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php 
  $dbHost = 'localhost'; 
  $dbUsername = 'u969692298_dogs'; 
  $dbPassword = 'dogs123'; 
  $dbName = 'u969692298_dogs'; 
  $db = new mysqli($dbHost,$dbUsername,$dbPassword,$dbName); 
  $searchTerm = $_GET['term']; 
  $query = $db-&gt;query(&quot;SELECT * FROM kennels WHERE name LIKE '%&quot;.$searchTerm.&quot;%' ORDER BY name ASC&quot;); 
  while ($row = $query-&gt;fetch_assoc()) { 
    $data[] = $row['name'];
  } 
  echo json_encode($data); 
  ?&gt; 
  </code></pre>