[PHP] adding 'vote' mechanism
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all, I have an SQL table that holds 'tips' and is linked to a table containing the authors details. I'd like to add a simple 'thumbs up, thumbs down' vote mechanism to it. The (simplified) table looks like this: id | authId | title | tip The only way I've come up with so far is to add two more fields (thumbs_up and thumbs_down). Then each time someone votes... get the current value of the field (say thumbs_up) use php to increment it's value and pop it back in the db. Is there a better way? - -- - --- www.explodingnet.com |Projects, Forums and +Articles for website owners - -- Nick Wilson -- |and designers. -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8d/CbHpvrrTa6L5oRAkiJAJ9jSWhYcfaYkCLwh89oBRgPO4qGAACfVk35 2wYbTAlhyXEEsXEOh/x7u8k= =N0Cm -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] adding 'vote' mechanism
On Saturday, February 23, 2002, at 02:42 PM, Nick Wilson wrote: I'd like to add a simple 'thumbs up, thumbs down' vote mechanism to it. The (simplified) table looks like this: id | authId | title | tip The only way I've come up with so far is to add two more fields (thumbs_up and thumbs_down). Then each time someone votes... get the current value of the field (say thumbs_up) use php to increment it's value and pop it back in the db. What if you made the field a signed INT field, and used PHP to subtract one from the current value of the field every time someone chose thumbs down or add one to the current value of the field every time someone chose thumbs up. This way you could have a level of how well the author stacks up. This is just another idea shooting the moon, the truth is that it would probably be fine either way. A matter of personal preference. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] adding 'vote' mechanism
I personally prefer voting mechanisms that display how many votes have been cast. If you keep the thumbs_up separate from thumbs_down, you can figure the total number of votes. Otherwise, you will not be able to know whether the author is *really* average or just never voted for. Steven J. Walker Walker Effects www.walkereffects.com [EMAIL PROTECTED] On Saturday, February 23, 2002, at 11:45 AM, Erik Price wrote: On Saturday, February 23, 2002, at 02:42 PM, Nick Wilson wrote: I'd like to add a simple 'thumbs up, thumbs down' vote mechanism to it. The (simplified) table looks like this: id | authId | title | tip The only way I've come up with so far is to add two more fields (thumbs_up and thumbs_down). Then each time someone votes... get the current value of the field (say thumbs_up) use php to increment it's value and pop it back in the db. What if you made the field a signed INT field, and used PHP to subtract one from the current value of the field every time someone chose thumbs down or add one to the current value of the field every time someone chose thumbs up. This way you could have a level of how well the author stacks up. This is just another idea shooting the moon, the truth is that it would probably be fine either way. A matter of personal preference. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php