Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8889079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:10:28+00:00 2026-06-14T22:10:28+00:00

I used auto complete box to my searching text box. Its working properly for

  • 0

I used auto complete box to my searching text box. Its working properly for me… this is my script..

<?php

require_once('database.php');

if(isset($_POST['queryString'])) {

    $queryString = $dbc->real_escape_string($_POST['queryString']);

    if(strlen($queryString) >0) {
        $q = "SELECT keyword 
                FROM (
                    SELECT tname AS keyword FROM t
                    UNION
                    SELECT sname AS keyword FROM sub
                    UNION
                    SELECT cname AS keyword FROM c
                    UNION
                    SELECT iname AS keyword FROM i
                ) s
              WHERE keyword LIKE '%$queryString%' 
              LIMIT 10";

        $r = mysqli_query ( $dbc, $q);

        if($q) {
            while ($row = mysqli_fetch_array($r, MYSQL_ASSOC)) {
                echo '<li onClick="fill(\''.$row['keyword'].'\');">'.$row['keyword'].'</li>';
            }
        } else {
            echo 'ERROR: There was a problem with the query.';
        }
    } else {

    }
} else {
    echo 'There should be no direct access to this script!';
}

?>

problem is my autocomplete box display all result in subjects,tutor names, institutes etc to related keyword. Now I want to categorize them in autocomplete box.. ex: subjects under subject category, tutor name under tutor category etc… what i am trying to do is something similar to facebook search option..

This is my jQuery:

<script type="text/javascript">

    function lookup(inputString) {

        if(inputString.length == 0) {
            $('#suggestions').hide();
        } else {
            $.post("rpc.php", {queryString: ""+inputString+""}, function(data){
                if(data.length >0) {
                    $('#suggestions').show();
                    $('#autoSuggestionsList').html(data);
                }
            });
        }
    }

    function fill(thisValue) {
        $('#inputString').val(thisValue);
        setTimeout("$('#suggestions').hide();", 200);
    }

</script>

can anybody help me to this?
Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:10:31+00:00Added an answer on June 14, 2026 at 10:10 pm

    Use a drop down near the search text input to select category or multiple checkbox to see what union you would have to make? I would recommend you Sphinx http://sphinxsearch.com/

    Try

    SELECT 1 as type,tname AS keyword FROM t
                        UNION
                        SELECT 2 as type,sname AS keyword FROM sub
                        UNION
                        SELECT 3 as type,cname AS keyword FROM c
                        UNION
                        SELECT 4 as type,iname AS keyword FROM i
    
    foreach($results as $result)
    {
        switch($result['type'])
        {
            case 1:
            $cat_1[]=$result;
            break;
    
            case 2:
            $cat_2[]=$result;
            break;
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on auto complete and used this http://jqueryui.com/demos/autocomplete/#combobox Now my query is
I am newbie to php.I have coded auto-complete text box using php,and i have
I have used auto complete textbox previously. That auto complete works only when i
I have used ajax auto completeextender in my program well its works fine no
I am using an autocomplete on my search box. Everything is working properly, except
I'm working on an auto-complete input field somewhat similar to the one on Facebook
I have an extjs combobox used for auto-complete having following configuration: xtype:'combo', displayField: 'name',
I have added search option to a project. There I used jquery auto complete
I have done autocomplete for my php code usign ajax.I used this code for
I have used the jquery auto complete plugin in my rails application and things

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.