Jump to content

Design questions for creating forums


chopps

Recommended Posts

 

Hello All,

 

I am trying to learn more about PHP and MySQL and wanted to create a forums component into a site.  The forums would allow users to vote how helpful an answer was similar to the system used by stackoverflow.com and yahoo answers.  The issue I'm running into is how would I stop a user from voting for the same answer multiple times.  I was thinking of creating a new column for each forum that will store the username of each user that has voted.  The function would then check to see if the username is already in there before allowing them to vote but it seems like it may add some additional and unnecessary overhead.  Does anyone know of a better way to accomplish this or am I just being overly paranoid?

 

Also, any suggestions on what type of storage engine to use for this purpose would be nice.  I was thinking MyISAM would work fine but not sure if I should use INNODB as it is transactional.  Any advice would be much appreciated.  :)

Link to comment
Share on other sites

I would have say just a 2 column table of 'votes'

 

The user id and the postid of the message that user has voted for.

 

But when the user goes to the page where that exists, if the user has already voted and their userid exists for that post in that row on the database, the link doesnt exist in the presentation of the page.

 

Whereas on any other message if the user doesnt exist on the postid of any other then it would show the link.

 

That logically speaking should work.

Link to comment
Share on other sites

It's an absolute pleasure.

 

Not being funny here but it's a very good theoretical thing a forum for database normalisation, when all tables relate to each other in some way.

 

Cardinality being quite important, where the user can subscribe or sign up but not post replies yet, cardinality can either be set as on or off, I mean it's more about diagrams (can't remember the symbol that's used to represent this), but means a users login doesn't have to exist on another table it relates to (in this case posts), if the user has not made any posts yet.

 

But they can have many posts, that's a 1 to many relationship.

 

Probably waffled too much but that's basic normalisation really, there are deeper levels I think going to 5th the normal form but anything over 2 or 3 starts to get a little too complex (why they go up to degree level to teach this even Masters degree's exist in information management, there's allot of money to be made (not in forums) but the world of information at large).

 

It's a good area to get into, but it's just being overly logical on how you want to understand the data and improve upon that.

 

Anyways good luck!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.