Salve,

stavo provando a fare un semplice autocomplete che prende i dati dal database ma ovviamente non funziona xD

Ho scritto questo codice ma non riesco a capire perchè non funzioni:

Codice PHP:
<head>

<script type="text/javascript">
$(document).ready(function()
{
    $('#auto').autocomplete(
    {
        source: "http://tecnomercatino.it/oc-content/themes/modern/database.php",
        minLength: 3
    });
});
</script>
</head>
<body>

<input type="text" id="auto" />
<?php 
$mydb 
= new mysqli("");
$text $mydb->real_escape_string($_GET['term']);
$table="componenti";
$table2="cpu_tab";
$sqlquery ="SELECT * FROM $table as o, cpu_tab as c WHERE o.ID=c.componenti_ID AND ID LIKE '%$text%'";
$result $mydb->query($sqlquery);
$json '[';
$first=true;
while(
$row $result->fetch_assoc())

{
    if (!
$first) { $json .=  ','; } else { $first false; }
    
$json .= '{"value":"'.$row['name'].'"}';
}
$json .= ']';
echo 
$json;
?>
</body>
Andando qui: http://tecnomercatino.it/oc-content/...n/database.php
vedete quello che non fa, ovvero non crea assolutamente un autocomplete ma stampa tutto affianco al text box .-.