php - what the best way to add multiple tags to a blog post? -


I really want to add more than one tag to a blog post when users select them from a field, To store the tags in Mysql, I have the fields to keep all tags, or one by one or

  tag_field = (cats, animals, fur)   

OR cats id2 animals id 3 fir

I used the first example Area was thinking and was detonated lists and they were separated in a tag when the user brings them !!! :)) Thanks

You should use three tables:

  • A table where you store posts; One line per line
  • A table where you store tags;
  • Used by many posts, and a post can contain many tags - and there is no duplication of any kind of data.


    So, basically, your table will look like this:

      Post-ID; Primary key - Date - Title - Content tag - ID; Primary key - name posts_tags - tag_id; primary key ; Foreign key for tags. Tag_id - post_id; primary key ; Foreign key for Posts.post_id    

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -