Counting votes

wxdqz

New Member
I'm working on a script that will allow my visitors to vote for a word in a db. But the problem is that when you click the vote button it won't count the first vote. If you click again it will start adding votes. And if you try to vote on another word on the page the first vote will go to the word you last voted for. What am I doing wrong?

I will try to add a cookie function later on so that each visitor only can vote for one word on the page and one time. Will this solve my problem?

Take a look at the page: <!-- m --><a class="postlink" href="http://www.dumper.no/test/10beste.php">http://www.dumper.no/test/10beste.php</a><!-- m -->

Or the source:

$result = mysql_query("SELECT ord, stemmer FROM glemteord ORDER BY stemmer DESC LIMIT 10",$mysql_access);

if ($result)
{
while(list($ord, $stemmer) = mysql_fetch_row($result))
{

echo ("<form action=\"$PHP_SELF\" method='POST'>
<a href='http://www.phpbuilder.com/board/archive/index.php/ord.php?name=$ord'>$ord</a> rating: $stemmer
<input type='SUBMIT' name=$ord value='http://www.phpbuilder.com/board/archive/index.php/stem'>
</form>");

$nystemme = $stemmer + 1;

if ("stem" == $$ord) {
$stem = mysql_query("UPDATE glemteord SET stemmer = \"$nystemme\" WHERE ord = \"$ord\"");
}

$count++;
}
} else
{

print ("Det har oppst錿t en feil! Code: '$result'<br>");

}

?>
 
Back
Top