Hello i am trying to user Autocomplete jqueryUI but i having trouble showing data from my database. I pretty sure that the problem lies there. Here is the code

define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', '');
define('DB_DATABASE', 'project');
$db = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD,DB_DATABASE) or die(mysqli_connect_error());
mysqli_query ($db,"set character_set_results='utf8'");

// if the 'term' variable is not sent with the request, exit
    // query the database table for zip codes that match 'term'
    $rs = mysqli_query('SELECT uid, username FROM users WHERE username LIKE "'. mysqli_real_escape_string($_REQUEST['term']) .'%" ORDER BY username ASC LIMIT 0,10', $db);
    // loop through each zipcode returned and format the response for jQuery
    if ( $rs && mysqli_num_rows($rs) )
        while( $row = mysqli_fetch_array($rs, MYSQL_ASSOC) )
            $row['uid'] .', '. $row['username'];

// jQuery wants JSON data
echo json_encode($data);


and here is when i call it

<form action="test/submit.php" method="POST" accept-charset="utf-8">
            <select id="select3" name="select3">
                <option value="sleep" class="selected">sleep</option>
                <option value="sport">sport</option>
                <option value="freestyle">freestyle</option>
            <input type="submit" value="Send">
        <script type="text/javascript">
                    json_url: "ajax_autocomplete.php",
                    addontab: true,                   
                    maxitems: 10,
                    input_min_size: 0,
                    height: 10,
                    cache: true,
                    newel: true,
                    select_all_text: "select",

Can you see an error?

Sorry but i cant make any donations because of the capital controls in Greece. :(

2 Years
Discussion Span
Last Post by SimonIoa

No that wasn't it. It wasnt making any difference anyway. Do you see any other errors?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.