Created
October 9, 2016 13:45
-
-
Save compilerexe/da009757b91ab985159fffde8b1af6ba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> | |
| <script src="//code.jquery.com/jquery-1.10.2.js"></script> | |
| <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> | |
| <script> | |
| $(function() { | |
| $( "#skills" ).autocomplete({ | |
| source: 'search.php' | |
| }); | |
| }); | |
| </script> | |
| <div class="ui-widget"> | |
| <label for="skills">Skills: </label> | |
| <input id="skills"> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //database configuration | |
| $dbHost = 'localhost'; | |
| $dbUsername = 'root'; | |
| $dbPassword = ''; | |
| $dbName = 'codexworld'; | |
| //connect with the database | |
| $db = new mysqli($dbHost,$dbUsername,$dbPassword,$dbName); | |
| //get search term | |
| $searchTerm = $_GET['term']; | |
| //get matched data from skills table | |
| $query = $db->query("SELECT * FROM skills WHERE skill LIKE '%".$searchTerm."%' ORDER BY skill ASC"); | |
| while ($row = $query->fetch_assoc()) { | |
| $data[] = $row['skill']; | |
| } | |
| //return json data | |
| echo json_encode($data); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment