Location: PHPKode > scripts > Php AddressBook 2 > php-addressbook-2/email-group.php
<?php
include_once("case.php"); 
include_once("config.php");
include_once("open-db.php"); 

# set date
$thedate = date("Y-m-d");

if($message == ""){
echo "No message address added. Please go back.";
}elseif($subject == ""){
echo "No subject added. Please go back.<br/>";
}else{
//sent message message loop
	/////////////////////////////////////////////////////////////////
	//Take the GID's from "groups" and look for them in "addressbook" 
	/////////////////////////////////////////////////////////////////
	$asql="SELECT * FROM addressbook WHERE gid LIKE '$gid'";
			
		# execute SQL statement
		$rs = mysql_query($asql, $cid);
		if (mysql_error()) { print "Database Error: $asql " . mysql_error(); }
	
		# execute SQL statement
		$rs = mysql_query($asql) or die ("Query failed"); //let's get the number of rows in our result so we can use it in a for loop
		$numofrows = mysql_num_rows($rs);
			if (!$numofrows == 0){ // Dont Display Empty Groups
	
			for($i = 0; $i < $numofrows; $i++) {
				$row = mysql_fetch_array($rs); //get a row from our result set
								
					include("rows.php");
					
					$Bmessage = "From: $yourmail\n\nFirst Name: $yourfirst\nLast Name: $yourlast\n\nDate: $thedate\nMessage: $message";
					$msg = ereg_replace("\\\'", "'", $Bmessage);
					mail($email, $subject, $msg, "From: $yourmail\r\nReply-to: $yourmail\r\n");
		
			}// End Info
		}// Dont Show Empty
?>
<meta http-equiv="refresh" content="0; url=<? echo "index2.php?title=sentGroup"; ?>"">
<?php
}// End Else
?>
Return current item: Php AddressBook 2