Answer the question
In order to leave comments, you need to log in
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>
Answer the question
In order to leave comments, you need to log in
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.
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 questionAsk a Question
731 491 924 answers to any question