Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/127010-solved-count-of-emails-in-dbase/
Share on other sites

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
}


?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.