0

I have an input box for search in my website which outputs instant results using an AngularJS search function on ng-keyup event. The condition for search in the PHP file is the search string more than 3 characters and more than one search result found. If these conditions are met the PHP file inserts a row in the keyword table with the number of results for each search. The advantage of this is to show the user instant search results while typing, but the disadvantage is that the different parts of a word are recorded in multiple table rows as follows:

Keywordsearch Table
----------------------------------------
keyword   results          datetime
----------------------------------------
cha         45       2019-09-06 10:55:19 
char        33       2019-09-06 10:55:19
chari       28       2019-09-06 11:03:12
charit      22       2019-09-06 11:24:04
charity     14       2019-09-06 11:34:44
----------------------------------------

My question: Is there a way in PHP, MySQL or AngularJS to extract the complete words after the user has stopped typing as charity from the keyword column from the keywordsearch table in this example, in order to output them in the most searched keywords section of my website?

georgeawg
  • 48,608
  • 13
  • 72
  • 95
user2985035
  • 569
  • 3
  • 8
  • 18

0 Answers0