The first time i click the vote link it won't display the vote i just gave, if I click again it counts as it should. But if I try to vote on another word the first vote goes to the last word I voted for. What am I doing wrong?
Check out 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 script:
//select word and rating
$result = mysql_query("SELECT ord, stemmer FROM glemteord WHERE uke<=week(curdate()-1) ORDER BY stemmer DESC LIMIT 10",$mysql_access);
//assign names to word and rating
while(list($ord, $stemmer) = mysql_fetch_row($result)) {
//print name and rating
echo ("<a href=http://www.phpbuilder.com/board/archive/index.php/\"ord.php?name=$ord\">$ord</a> votes: $stemmer
<a href=\"$PHP_SELF?valg=$ord\">Vote for this word</a><br>");
//set vote
if ($valg == $ord)
$stem = mysql_query("UPDATE glemteord SET stemmer = stemmer+1 WHERE ord = \"$ord\"");
}
Thanks!
Check out 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 script:
//select word and rating
$result = mysql_query("SELECT ord, stemmer FROM glemteord WHERE uke<=week(curdate()-1) ORDER BY stemmer DESC LIMIT 10",$mysql_access);
//assign names to word and rating
while(list($ord, $stemmer) = mysql_fetch_row($result)) {
//print name and rating
echo ("<a href=http://www.phpbuilder.com/board/archive/index.php/\"ord.php?name=$ord\">$ord</a> votes: $stemmer
<a href=\"$PHP_SELF?valg=$ord\">Vote for this word</a><br>");
//set vote
if ($valg == $ord)
$stem = mysql_query("UPDATE glemteord SET stemmer = stemmer+1 WHERE ord = \"$ord\"");
}
Thanks!