Jump to content

How Do I Create Categories For A Blog Post?


signature16

Recommended Posts

I created a very simple shoutbox.  User posts their name and a message and clicks post.  It posts to the database and when the page reloads, the "shout" is displayed.

 

I would like to add categories to this little shoutbox application I created.  The user should be able to check off boxes to apply different categories to a post.  For example a shout could be in the categories, php,mysql,html and css.

 

 

Logistically how do I do this using MySQL and PHP?  ... Obviously this is just a project for learning and has no real application.

 

Thanks.

there is about a million ways to do this.

1 make a static array in php

2 make an mysql table of them and query them

3 make a mysql table and then use an enum field for optimized storage

4 make the second mysql table store then as integers in the new one and use a psedo enum on output.

 

5-1million any varieation on the above or what ever you like

Ok lets say I am going to go with option 2... or at least definitely not option 1.

 

Do I create two tables? 

.... one for the posts (id,title,categories,message) and one for the categories (id,category,description)?

 

 

This is where I get confused. 

 

 

Once I have two tables what do I do?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.