DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Cerberus Recent Requesters

  • submit to reddit
        Display a list of email addresses for people who have filed tickets in the past 30 days.

$database = 'cerberus';
$username = 'cerberus';
$password = 'cerberus';
$hostname = 'localhost';

$sql = "
SELECT distinct address.address_address
FROM ticket, requestor, address
WHERE  DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= last_update_date
AND ticket_status='resolved'
AND ticket.ticket_id=requestor.ticket_id
AND requestor.suppress='0'
AND requestor.address_id=address.address_id";

mysql_connect($hostname,$username,$password) or die('error connecting to the database');
@mysql_select_db($database) or die('unable to select database');
$result = mysql_query($sql) or die(mysql_error());

$i = 0;
while($i < $num) {
	$address_address = mysql_result($result,$i,"address.address_address");
	echo "$address_address<br/>";