web_master Posted October 4, 2008 Share Posted October 4, 2008 hi, I want to made one vote form. One person - one email - can vote 4 times only. How can I do it to when he count 4 times to can't do anymore? <?php $query_return_vote4 = mysql_query("SELECT DISTINCT `l_voter_email` FROM `l_voter` WHERE `l_voter_email` = '".$_POST['l_voter_email']."'"); if (!$query_return_vote4){ print mysql_error(); exit; } $request_vote4 = mysql_num_rows($query_return_vote4); //this brings me nr 1. if there one or more same emails - I want to add (plus) the equal e-mail rows. So if its a 4 same emails in table than: if($request_vote4 == "4") { $vote_error = "You cannot vote anymore"; } else { //insert into dBase query } ?> THNXS Quote Link to comment https://forums.phpfreaks.com/topic/127010-solved-count-of-emails-in-dbase/ Share on other sites More sharing options...
R0bb0b Posted October 4, 2008 Share Posted October 4, 2008 Made a few tweeks, this should do it if you have it set up the way I think you do. <?php $query_return_vote4 = mysql_query("SELECT `l_voter_email` FROM `l_voter` WHERE `l_voter_email` = '".$_POST['l_voter_email']."'"); if (!$query_return_vote4){ print mysql_error(); exit; } $request_vote4 = mysql_num_rows($query_return_vote4); //this brings me nr 1. if there one or more same emails - I want to add (plus) the equal e-mail rows. So if its a 4 same emails in table than: if($request_vote4 > "4") { $vote_error = "You cannot vote anymore"; } else { //insert into dBase query } ?> Quote Link to comment https://forums.phpfreaks.com/topic/127010-solved-count-of-emails-in-dbase/#findComment-657013 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.