I'm trying to get autocomplete to search my oracle database, but it's not working.
I made the script in the page header:
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script><linkrel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script>
$(function(){
var autocompletar = new Array();
<?php
for($p=0;$p < count($procedimentos); $p++) { ?>
autocompletar.push('<?php echo $procedimentos[$p];?>');
<?php } ?>
$("#buscar").autocomplete({
source: autocompletar
});
});
</script>
Next, make the connection / query in the database and create an Array for the values:
<?php
header('Content-Type: text/html; charset=utf-8');
//CONEXÃO COM O BANCO DE DADOS ORACLE
$conn = oci_connect('****', '****', '****', 'AL32UTF8');
$sql_proc = "select cd_procedimento, ds_procedimento from procedimento where ie_origem_proced in (1,5) and ie_situacao='A' order by ds_procedimento";
$parsed_proced = oci_parse($conn,$sql_proc);
oci_execute($parsed_proced);
$procedimentos = array();
while (($valor = oci_fetch_array($parsed_proced, OCI_ASSOC+OCI_RETURN_NULLS))) {
foreach($valor as $valor_col){
array_push($procedimentos, $valor_col);
}
}
?>
And then finally I make the input on the page:
<input id="buscar">
But it is not bringing any input! What can I be doing wrong?