Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //echo "ddjjdjd";die;
- $servername = "localhost";
- $username = "root";
- $password = "";
- $db ="rentozy_db";
- // Create connection
- $conn = new mysqli($servername, $username, $password,$db);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- echo "Connected successfully";
- //require_once ('db_connection.php');
- $q=$_REQUEST["q"];
- //$q=$_REQUEST["term"];
- //$searchTerm = $_GET['term'];
- $sql="SELECT `pg_address` FROM `tbl_master_property` WHERE pg_address LIKE '%$q%'";
- $result = mysql_query($sql);
- $json=array();
- while($row = mysql_fetch_array($result)) {
- array_push($json, $row['pg_address']);
- }
- echo json_encode($json);
- ?>
- <script src="//code.jquery.com/jquery-1.10.2.js"></script>
- <script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
- <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" />
- <script type="text/javascript">
- $(function() {
- $( "#location" ).autocomplete({
- source: function( request, response ) {
- $.ajax({
- url: "gethint.php",
- dataType: "jsonp",
- data: {
- q: request.term
- },
- success: function(data) {
- response(data);
- }
- });
- },
- });
- });
- </script>
- <input type="text" id="location" placeholder="Search by location" name="location" list="locations" class="searchlocation" />
Add Comment
Please, Sign In to add comment