How to insert Tags into a MYSQL database using PHP?

Asked

Viewed 430 times

0

good afternoon! I have a knowledge base system where every user can go in there and fill out a form and register the procedure that they know. I am needing to implement a TAG field in this knowledge registration form, this field will be used for the future document to be searched. Each document when inserted into the bank has a unique ID, my question is:

NOTE: The entry of data in this field of TAGS would be through a TAG FIELD (As it is done here in the forum when registering the question)

How will the data be entered into the mysql database, since each procedure has a unique ID? Example: Procedure 1 - How to use ipconfig - TAGS: Windows, network, msdos.

How do these three tag values go to the mysql database? which has a FIELD called Tags ?

From what I understand in mysql the records would be + o - like this:

| id   |  procedimento_ nome   | tags                    |  
|  01  |  Como usar o ipconfig | Windows, rede, msdos    |

Thank you!

  • 1

    I think it’s the same problem as this: http://answall.com/questions/48695/70 - of any form I think you need to explain better how the person will enter the tags in your system. has different ways of doing it, it all depends on how you use it later.

  • then, as I said, the input of the data will be done in the registration form... the person when registering the document he will have a field called TAGS (similar to what we use here in the forum when we ask questions) and then these Tagas that she registered will serve for research later.

  • 1

    Registration entry can be a free text field, it can be a tag choice component, it can be a predefined list. There are many ways that can change the choice. It may be that in your case a table of tags helps, it may be worth doing directly in text field. Depending on how the search by tag varies the way of organizing as well. It is all these (and other) details that can change the answers, and could be in the body of the question to prevent it from getting too broad. I would suggest [Dit] and better describe the requirements and operation (this helps to get more accurate answers)

  • would it be like creating an array of tags and putting them in the database? and at tag search time the user chooses one and in sql would search for articles with the chosen tag?

  • 1

    In principle, without the details I mentioned in the previous comment, it would just send the tag field in the same way as any other text field. Have you tried this? What alternatives have you tried, and what difficulties have you encountered?

  • So Bacco, I’m really not able to explain myself, but from what I understood what I need would really be this issue of making a relationship 1:n... because I would store all the tags that the client registered in the bank related to that document x... type TAG1 -> Doc1 | Tag2 -> Doc1 | Tag3 -> Doc1 ... I will research how to create this relationship!

  • 1

    @Igorsantana if you edit the question explaining better what you want to do first, the community can help you. The problem with the question not describing the specific current problem is that it runs the risk of answering things that are not what you expect. It may be that one reader worries about the part of the Insert, another about the interface of editing the tags and how to receive and process what came in the form, and a third about the part of the relationship. If you can concentrate the question on one problem, it helps. After you solve each step, open + questions.

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.