www.webdeveloper.com
Results 1 to 2 of 2

Thread: Ajax.Autocompleter Not working!

  1. #1
    Join Date
    Apr 2008
    Posts
    2

    Ajax.Autocompleter Not working!

    Greetings.

    I'm trying out the script.acul.ous Ajax.Autocompleter and I am not getting any results.

    test.php:
    PHP Code:
    <html>
        <
    head>
            <
    link type="text/css" rel="stylesheet" href="resources/styles/style_index.css">
            <
    script src="resources/js/prototype.js" type="text/javascript"></script>
            <script src="resources/js/scriptaculous.js" type="text/javascript"></script>
            <script type="text/javascript">
                var myAutoCompleter = new Ajax.Autocompleter('username', 'suggestionBox', 'suggest_username.php', {minChars: 0, frequency: 0.1});
            </script>
            <style>
            .selected { 
                background-color: #ffffef; 
            }

            #suggestionBox { 
                display: none; 
                border: 1px solid #888888; 
                background-color: #efefff;
                width: 200px;
            }
            </style>
        </head>
        <body>
            <input type="text" name="username" id='username'>
            <div id="suggestionBox"></div>
        </body>
    </html> 
    suggest_username.php
    PHP Code:
    <?php
        
    require_once "include/connection.php";
        
        
    $link openDB();
        
        
    $str $_POST['username'];
        
        
    $result mysql_query("SELECT * FROM users WHERE username LIKE '$str%'"$link) or die(mysql_error());
        
    $count mysql_num_rows($result);
        
        echo 
    "<ul>";
        if(
    $count 0) {
            while(
    $data mysql_fetch_array($result)) {
                echo 
    "<li>" $data['username'] . "</li>";
            }
        } else {
            echo 
    "<li>No results.</li>";
        }
        echo 
    "</ul>";
    ?>
    What am I doing wrong? Please help me.


    Best Regards,
    zEeLi
    Last edited by zeeli; 04-08-2008 at 03:53 PM.

  2. #2
    Join Date
    Apr 2008
    Posts
    2
    Anyone?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles