Hi all,
Am having a bit of a problem understanding this, can anybody tell me where
i'm going wrong please?

Basically trying to limit the "vote" to just 1 per person, first am checking
if the the person with username has voted, if that comes back as false then
am checking his ip (because i dont know if  the person changed his username
and is trying to vote again) now its allowing me to vote twice and on the
third time its restricting me.

*****************code*************
$check="select vote_date from site_rateing where user='".$username."' and
sitenumber=".$n;
$res = mysql_query($check) or die("Error: " . mysql_error());
$check_result = mysql_num_rows($res);

 if($check_result !=1)
  { $oneVote=1;

  $check2="select count(*) from site_rateing where ipno='".$theIP."' and
sitenumber=".$n;
  $check_result2 = mysql_result(mysql_query($check2),0);

    if($check_result2 >=1)
    { $oneVote=2;}else{$oneVote=1;}

  }// end of first "if"


    if($oneVote ==2)
    {
     $row = mysql_fetch_row($res);
     print("Sorry, You have already voted on ".$row[0].".<br> Only one vote
is allowed");
     exit;
    }
else
//continue with the program.
*****************code*************

Any ideas?

Thanks,
-Ryan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to