SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2005
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    This script doesn't work right...

    I use this script to add a vote to a votecount in my database. i want it to add a vote each time the link to the particular song is clicked. (So each disticint song has its own votecount) The problem seems to be that when you click on the vote link several times it doesn't keep adding a new vote to the total. Can anyone tell me why? Thanks!
    PHP Code:
    if (isset($_GET['vote']))
    {
    $votedsong=$_GET['vote'];
    $getvotecountq=mysql_query("SELECT weekvotecount, yearvotecount FROM songs WHERE memberid = '$id'");
    while(
    $gvc=mysql_fetch_array($getvotecountq))
    {
    $weekvotecount=$gvc['weekvotecount'];
    $yearvotecount=$gvc['yearvotecount'];
    $week=$weekvotecount 1;
    $year=$yearvotecount 1;
    $addvote=mysql_query("UPDATE songs SET weekvotecount= '$week', yearvotecount= '$year' WHERE memberid = '$id' AND songname= '$votedsong'") or die(mysql_error());
    }} 

  2. #2
    SitePoint Enthusiast
    Join Date
    Sep 2005
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It seems like maybe it will count each vote just not two votes in a row. For example... I click on the vote submit link for 'song a' and the vote is added. I click on the link for 'song b' and the vote is added. I click on 'song a' again same deal. But, when I click on 'song a' twice in row. The second reload of the page doesn't add to the vote count again. Arghhh! Maybe this is a good thing, but I think I want it so that someone can vote for their song as many times as they want.


Bookmarks

Posting Permissions

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