1
How to store the last 100 searches made to a website (PHP/MYSQL) divided by countries (e.g., store the last 100 searches for books in Macedonia). Search is a simple field:
<input type="text" id="search" name="search" placeholder="Search" />
What is the best way to "collect" this information that does not compromise performance (I think that every new research has to be included in the bank is too expensive), and the best way to structure this information in tables in the bank? and how to create a limitation to 100 searches per country and work in a similar way to a queue (always keeping up to date with 100 searches)? This list should be accessible to all users and updated in real time how to do the application level too.
Country table:
CREATE TABLE pais(
id INTEGER NOT NULL AUTO_INCREMENT,
codigo CHAR(2) NOT NULL UNIQUE,
nome VARCHAR(70) NOT NULL,
PRIMARY KEY(id));
Note: this code is the ISO country code.
You want to store
id_pais => palavra_pesquisada
?– Jorge B.
yes would be like a table where one column is the country id and the other the searched word, the problem that as are many searches I would like a more efficient way to do the insertion in the bank
– Ricardo
You can always store it in a log and at the end of the day, at a dead time, insert it in the bank. Or it needs to be updated on time?
– Jorge B.
@Jorgeb. should be updated in real time.
– Ricardo