L
L
LegitPlayer2020-05-20 04:29:42
Web development
LegitPlayer, 2020-05-20 04:29:42

How to write keywords to the database?

Using Tokenize2 , the user enters a tag and selects it from a drop down list. As a result, the tags look like this, how to write them to the database? ( Gabon , Gambia ):

<ul class="tokens-container form-control" tabindex="0">
<li class="token" data-value="GA"><a class="dismiss"></a><span>Gabon</span></li>
<li class="token" data-value="GM"><a class="dismiss"></a><span>Gambia</span></li>
<li class="token-search" style="width: 19px;"><input autocomplete="off"></li></ul>

I'm thinking of parsing these values ​​and loading them via NodeJS.
Perhaps there are better options?
Is there anything better than Tokenize2 with a combobox?
Is it better to write keywords in different cells, or in one with separators?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Arseny, 2020-05-20
Matytsyn @ArsenyMatytsyn

In this execution, a simple entry into a string separated by commas is enough.
In a slightly more complex situation, for example, a tag has 2 parameters, a title and a link, I would already recommend using objects with a JSON or LONGTEXT type record.

F
FanatPHP, 2020-05-20
@FanatPHP

1. You need to figure out how data is sent to the backend. There are no tokens and containers there. And you don't need to "parse" anything
2. You need to figure out what a database is. And then the question "to store separated by commas" in principle will not arise. Everything is stored separately in the database. Especially keywords. All keywords are stored in a separate table. To bind to records, another table is made, with two columns. Record ID + Keyword ID

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question