Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/287049-autocomplete-search-bar/
Share on other sites

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.

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.