Hi,
I've done a lot of searching on this topic, but different websites seem to give different recommendations.
There are two basic parts of functionality to a business application I'm working on:
1- A search box. When a user types in it, it will display a list of suggestions (using java/ajax).
2- A display area. Once the user has completed the search (ie clicked one of the suggestions), more details about the searched item will be displayed.
My question is - what would be the best way to handle the connections to MYSQL when performing the auto-suggest?
For example - when the search box is typed in, ajax will call "getsuggestion.php" passing the current search string.
This file will then connect to the database, search for the value the user has typed, then send the results back to ajax & be displayed to the user.
What I'm really wanting to know, is should "getsuggestion.php" open AND close the mysql connection each time it is called? Or should I not be closing the connection?
I'm asking this because the application will be used by potentially >1000 people at the company I work for, and I don't want there to be database connectivity issues - or speed issues when performing the autosuggest.
Any hints/tips would be greatly appreciated.
Thanks