I'm attempting to implement a method on my small website much like those of Facebook's "Like" feature. Where customers can click a control button which counter++'s. However, I've encounter an issue when it comes to effectively storing data into my DB.

Each story has it's own row within the stories table during my DB using the posts like and users_like.

I would like each individual to simply have the ability to such as the story once. Therefore I have to in some way store data that implies that the consumer has, actually, like++'d the publish.

All I possibly could factor of was to possess a column named users_like after which add each user, then a comma, towards the column using CONCAT after which while using php function to explode the information.

However, this process, so far as I understand, is incorporated in the other direction of database normalization.

What's the easiest method to do that and that i understand "best" is subjective.

I am unable to give a liked flag towards the user table because you will see a huge quantity of tales the individual could 'like.'

Thanks

You'll need a many to a lot of table inside your database which will store an overseas answer to the stories table along with a foreign answer to the user table. You place a constraint about this table stating that the storyline fk - user fk combo should be unique.

At this point you don't even need to have a like column, you simply count the amount of rows within the many to a lot of table akin to your story.