0

i'm trying to use a jquery autocomplete text-input with a mysql database for autocomplete suggestions. From a tutorial i got the following php function that is used to query a database.

<?php
include "db_connect.php";
$search = protect($_GET['term']);   

$result = mysql_query("SELECT planeID FROM `planes` WHERE `planeID` LIKE '%$search%'     ")     
or die('Something went wrong');

$json = '[';
$first = true;
while ($row = mysql_fetch_assoc($result))
{
    if (!$first) { $json .=  ','; } else { $first = false; }
    $json .= '{"value":"'.$row['planeID'].'"}';
}
$json .= ']';
echo $json;

within the chrome networkpanel, i can see, that after each input into my textfield a request to "suggest_planeID.php?term=d-" i sent but i don't reveive any suggestion.

the database looks like this: i have ha DatatBase called "test" with a table caled "planes" inside. This table has two columns 'planeID' and 'planeType".

is there any chance to debug the php file to find the error or does anyone here already see the error?

4

0 回答 0