Jump to content

[SOLVED] count of emails in dBase


web_master

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
}


?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.