Location: PHPKode > scripts > Mass Emailing > bulk-emailer/admin/users/functions/users.php
<?
/************************************

Script : Free BULK / MASS EMAILER
Website : http://www.agrizlive.com

Script is provided Under GPU Non-Commercial License
Agrizlive.com doesn't provide any WARRANTY for this script
**************************************/

function getTotalUsers()
{
	$query = "SELECT * FROM ".TABLE_PREFIX."users";
	$result = mysql_query($query);
	
	return mysql_num_rows($result);
}

function getUsers($limit)
{
	$query = "SELECT * FROM ".TABLE_PREFIX."users LIMIT $limit,10";
	$result = mysql_query($query);
	
	return $result;
}


function getUsersByID($id)
{
	$query = "SELECT * FROM ".TABLE_PREFIX."users WHERE user_id = $id";
	$result = mysql_query($query);
	
	$value = mysql_fetch_array($result);
	return $value;
}

function addUserDetails($username,$email)
{
	$status = checkUserEmail($email);
	if($status == 'found'){
		return " - Email already exists";
	}
	
	$query = "INSERT INTO ".TABLE_PREFIX."users(user_name,user_email) VALUES('".$username."','".$email."')";
	$result = mysql_query($query);
	if($result){
		return " - Added successfully";
	}
	else{
		return " - There is a problem in adding the record";
	}
}

function editUserDetails($username,$email,$id)
{
	$status = checkUserEmail($email,$id);
	if($status == 'found'){
		return " - Email already exists";
	}
	
	$query = "UPDATE ".TABLE_PREFIX."users SET user_name = '".$username."', user_email = '".$email."' WHERE user_id = $id";
	$result = mysql_query($query);
	if($result){
		return " - Editted successfully";
	}
	else{
		return " - There is a problem in edittng the record";
	}
}

function checkUserEmail($email,$id = 0)
{
	$query = "SELECT user_email FROM ".TABLE_PREFIX."users WHERE user_email = '$email' AND user_id != $id";
	$result = mysql_query($query);
	
	if(mysql_num_rows($result) > 0){
		return 'found';
	}
	else {
		return 'not found';
	}
}

function deleteUser($id)
{
	$query = "DELETE FROM ".TABLE_PREFIX."users WHERE user_id = $id";
	$result = mysql_query($query);
	if($result){
		return " Deleted successfully";
	}
	else{
		return " There is a problem in deleting the record";
	}
}

?>
Return current item: Mass Emailing