Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Posts
    241
    Thanks
    6
    Thanked 0 Times in 0 Posts

    autosuggest help.

    Hello,

    I am wanting to add autosuggest to my application. I have a database that pulls names of buildings to show on google maps. I would like to add a building search feature.

    I have seen a few jquery examples, is there a way to maybe pull the data from the database and store in some array or something similar?


    Thanks

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder
    Join Date
    Sep 2007
    Posts
    241
    Thanks
    6
    Thanked 0 Times in 0 Posts
    abduraooft,

    Thanks for the link,

    This is what I am referring to:
    My demo

    I have seen a few of these that have a response time that is almost instantaneous. So I am wondering if my delay is due the speed of the server.

    I also have this jquery example:
    jquery autocomplete

    The second (jquery) calls from an array/plugin.

    Ok, I had found this on my work computer, this is what I would like to do http://www.simonwhatley.co.uk/exampl...mplete/jquery/

    and it pulls from this:
    Code:
    <?php
    $q = strtolower($_GET["q"]);
    if (!$q) return;
    $items = array(
    "1"=>"Algeria",
    "2"=>"Argentina",
    "3"=>"Australia",
       //the rest are continued//
    "96"=>"Vietnam",
    "97"=>"West Africa",
    "98"=>"Yemen",
    "99"=>"Yugoslavia",
    "100"=>"Zimbabwe"
    );
    
    foreach ($items as $key=>$value) {
    	if (strpos(strtolower($value), $q) !== false) {
    		echo "$value\n";
    	}
    }
    
    
    ?>
    Is there a way to query the database and build/store this array with the new data? Most of this will stay the same for the majority of the time, and seems wasteful to pull from the database each time. The plan is to make an admin panel or some other kind of backend to keep the data up to date. So I had figured I could have a function call or something to build this array.
    Last edited by dajohnson1s; 03-07-2009 at 06:43 PM.


  •  

    Posting Permissions

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