Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2007
    Location
    Sweden
    Posts
    5

    Question I want a vote system like Digg.com in my database.

    I want a vote system like Digg.com in my database. Need help to put in the VOTE part on the right spot in my ER- and relational diagram along with the right Crows notation.
    Or maybe an explanation on how to think to accomplish this.
    ( I use PHP and MySQL. )

    1.)
    A picture of my ER-diagram:
    http://tinypics.us/out.php/i5773_tutorials02.gif

    2.)
    I want it so that only members can vote like how things work in Digg.com when you like or dislike a story.
    The difference with my voting system is that I want to be able to get all the Positive and Negative votes and print it out and calculate the difference like so:
    http://tinypics.us/out.php/i5775_math02.gif
    I just don't know what Datatype to use for this voting part and how to grab and sum up all the votes correctly?

    3.)
    Here's my Relational diagram
    http://tinypics.us/out.php/i5776_relational01.gif

    4.)
    Picture of my Link tables:
    http://tinypics.us/out.php/i5774_link01.gif
    Last edited by bankai; 06-18-07 at 20:07.

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Sounds dangerously like a homework assignment
    Ok, here's my advice:
    1. Think of it this way - one item/article/whatever can have many votes.
    2. Use SQL - a simple function called Sum() should do the trick
      As for your datatype - hwo ig is your voting scale? 0 to 10, -100 to 100, 1 to 1,000,000 etc etc.
      For information on the T-SQL datatypes check this link

    HTH
    George
    Home | Blog

  3. #3
    Join Date
    Jun 2007
    Location
    Sweden
    Posts
    5
    tnx.

    (12345678910characters.)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •