Answer the question
In order to leave comments, you need to log in
How to avoid matches in DB and add new data?
I have a posts table with posts. Posts have tags, which are implemented by the tags and posts_tags tables. Posts are added using a parser.
The process looks like this:
1. the parser outputs data to json >
2. the php script turns this data first into an array, and then into ready-made commands for sql >
3. control-contolve sql code in phpmyadmin
An important point, tags can be new, which are not in db. Question: how in this case to check if there is a tag or not? And what are the options?
Addition: there was an idea to check tag_name using LIKE, but suddenly there are some more convenient ways
Posts table structure:
------------------
posts
------------------
post_id
------------------
post_body
------------------
------------------
posts_tags
------------------
post_id
------------------
tag_id
------------------
------------------
tags
------------------
tag_id
------------------
tag_name
------------------
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question