microbert Posted March 18, 2014 Share Posted March 18, 2014 Hi, I am trying to make an autocomplete search bar - so for example if want to search for "Sony D3256 Camera" and I type "Sony camera" in the search bar, it still suggest the "Sony D3256 Camera". The ones that I found on blogs and forums are the ones that shows the suggestion until you break the sequence of the name. I am using PHP and MySQL Is this possible, or cannot be done? Quote Link to comment https://forums.phpfreaks.com/topic/287049-autocomplete-search-bar/ Share on other sites More sharing options...
ginerjm Posted March 18, 2014 Share Posted March 18, 2014 Is this search bar being used to pinpoint an item in a dropdown or some other screen element or do you expect this to trigger an ajax request to hit the server with some kind of 'like' query? The latter could be very cumbersome with a slow or unreliable connection, especially if you expect it to interpret your input value as your example showed, and not be just a straight auto-complete. Quote Link to comment https://forums.phpfreaks.com/topic/287049-autocomplete-search-bar/#findComment-1472976 Share on other sites More sharing options...
microbert Posted March 18, 2014 Author Share Posted March 18, 2014 It is for a Like query and it going to generate a new page with search result. Quote Link to comment https://forums.phpfreaks.com/topic/287049-autocomplete-search-bar/#findComment-1472981 Share on other sites More sharing options...
ginerjm Posted March 18, 2014 Share Posted March 18, 2014 I wouldn't call it an "auto-complete" in that case. IMHO, an auto-complete does its thing while still presenting the same page with only the proposed results(s) being modified. To me it sounds like you want to regenerate the page after each character is typed which would be more time consuming than simply letting the user type in their search request. Quote Link to comment https://forums.phpfreaks.com/topic/287049-autocomplete-search-bar/#findComment-1472986 Share on other sites More sharing options...
Crew-Portal Posted March 19, 2014 Share Posted March 19, 2014 I have to completely agree with ginerjm. Keep your code simple, more un-needed scripting not only uses up more of your time to create and diagnose but it also increases the loading time of each page. Depending on how much traffic your website is getting these little pieces of unneeded, heavy transfer code can bring even the mightiest of servers to their knees. Quote Link to comment https://forums.phpfreaks.com/topic/287049-autocomplete-search-bar/#findComment-1473070 Share on other sites More sharing options...
microbert Posted March 20, 2014 Author Share Posted March 20, 2014 And if I decide to make it an auto-complete - meaning that the result are display as a pop out menu? is that better ? and it is possible? Quote Link to comment https://forums.phpfreaks.com/topic/287049-autocomplete-search-bar/#findComment-1473260 Share on other sites More sharing options...
ginerjm Posted March 20, 2014 Share Posted March 20, 2014 You still have to have an ajax process hitting the server with each new addition to your search argument. Could be slow. Quote Link to comment https://forums.phpfreaks.com/topic/287049-autocomplete-search-bar/#findComment-1473307 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.