Reviews/votes/Mood class functions What mechanism restricts members to be able to vote the most convenient?
Some like the review of the system, such as: The article below, showing: positive/negative comments such a button
That is, like the CSDN Forum article page ...
Useful for me [0] throw a brick [0]
Personal Understanding:
Click through AJAX/JQ this kind of send to PHP operation MySQL, put the praise/bad comment field +1
However, generally this type of east, are restricted to IP, or even a cookie only ...
If the positive/negative data do need to be very accurate without moisture
I would like to use a member login to review (voting bad)
Does MySQL need to suggest a separate review table?
There is a data architecture what better way, can limit members only to vote once?
What good advice do you have, please?
------Solution--------------------
It's necessary to build a table, and more than one.
Because you may also have xx concern xx, xx is xx's friend and so on a series of needs
Need comprehensive consideration
What you are thinking now is the core of the SNS website (or the basic)
------Solution--------------------
See below:
Voting Information table:
CREATE TABLE ' votes ' (
' id ' int (one) not NULL auto_increment,
' IP ' varchar (+) not NULL,
UID Int (one) is not NULL,
' Vid ' int (one) is not NULL,
' Fstcreate ' timestamp not NULL the DEFAULT current_timestamp on UPDATE current_timestamp,
PRIMARY KEY (' id ')
) Engine=myisam auto_increment=1 DEFAULT Charset=utf8
Article table
CREATE TABLE ' article ' (
' id ' int (one) not NULL auto_increment,
' Article_title ' varchar (+) not NULL,
' Article_type ' int (one) is not NULL,
' Article_content ' longtext not NULL,
' Article_author ' varchar (not NULL),
' Article_click_count ' int (one) not NULL DEFAULT ' 0 ',
' Status ' int (one) not NULL DEFAULT ' 0 ',
' Likes ' int (one) DEFAULT ' 0 ',
' Unlikes ' int (one) DEFAULT ' 0 ',
' Fstcreate ' timestamp not NULL the DEFAULT current_timestamp on UPDATE current_timestamp,
' Lastmodify ' datetime DEFAULT NULL,
PRIMARY KEY (' id '),
Fulltext KEY ' Fulltext_article_title ' (' article_title ', ' article_content ', ' key_words ')
) Engine=myisam auto_increment=119 DEFAULT charset=utf8 checksum=1 delay_key_write=1 row_format=dynamic COMMENT= ' article table '
You can vote only if the user is restricted to the user ID and the subject ID of the poll.
------Solution--------------------
The same comment can only be cast once on the same user.
The table structure can be this way
Id
Aid Reviews ID
Mid User ID
Addtime Time
Select COUNT (*) from table where aid=? and mid=? Determine if the user can vote on this comment again. = 1.