jquery autocomplete database
<?php
require "database/database.php";
$data = mysql_query("SELECT * FROM countries");
$result = array();
while($row = mysql_fetch_assoc($data)) {
$result[] = array(
'label' = $row['countryname'],
'value' = $row['countryname']
);
}
echo json_encode($result);
flush();
}
?>
<?php
require_once('connection.php');
function get_city($conn , $term){
$query = "SELECT * FROM city WHERE city_name LIKE '%".$term."%' ORDER BY city_name ASC";
$result = mysqli_query($conn, $query);
$data = mysqli_fetch_all($result,MYSQLI_ASSOC);
return $data;
}
if (isset($_GET['term'])) {
$getCity = get_city($conn, $_GET['term']);
$cityList = array();
foreach($getCity as $city){
$cityList[] = $city['city_name'];
}
echo json_encode($cityList);
}
?>
Also in JavaScript:
- Syntax Error: Thread Loader (Worker 0) .eslintrc.js: Environment key "es2021" is unknown at Array.forEach (<anonymous>)
- devexpress dxdatagrid custom text field link
- js redirect code
- file origin does not match viewer's pdf.js
- transfer data from one component to another angular
- jquery each has class
- beautify json python
- javascript random number
- pyspark json multiline
- replace all javascript
- how to update angular version
- string pop last char js
- js check if variable is string
- how to include local image files in javascript object
- react dropdown menu stack overflow
- require is not defined javascript
- socket io get ip
- javascript get browser is electron
- node js return json
- jquery do something if toggle open and close
- get latlong of address in here map api javascript
- javascript email validation
- make object move towards player p5js
- generate module with routing in angular