I\'m trying to create an auto-complete function into a textbox but the result should come from my SQL database.
Here\'s the code that i\'m trying to configure:
<
Solved my problem.
Have the script like this:
And autocomplete.php (where we will get the data to fill the autocomplete input field):
prepare("SELECT description FROM table"); /* START PREPARED STATEMENT */
$stmt->execute(); /* EXECUTE THE QUERY */
$stmt->bind_result($description); /* BIND THE RESULT TO THIS VARIABLE */
while($stmt->fetch()){ /* FETCH ALL RESULTS */
$description_arr[] = $description; /* STORE EACH RESULT TO THIS VARIABLE IN ARRAY */
} /* END OF WHILE LOOP */
echo json_encode($description_arr); /* ECHO ALL THE RESULTS */
?>