Location: PHPKode > projects > The Community Wish List Server > wlserver/admin/allpurchases.php
<?php

print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
print("<!DOCTYPE html\n");
print("PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n");
print("\t\" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\" >\n");
print("\t<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n");
print("\t\t<head>\n");
print("\t\t\t<title>All Claims</title>\n");
print("<script language=\"JavaScript1.2\" type=\"text/javascript\" src=\"../wishlist.js\"></script>\n");
print("<link rel=\"STYLESHEET\" type=\"text/css\" href=\"../wishlist.css\" />");
print("\t\t</head>\n");
print("\t<body bgcolor=\"#ffffff\">\n");

include("../../php/dbconnect.php");

print("<table border=\"1\">\n");
$getUsers="
	select
		personKey,
		fName,
		lName
	from
		person";
$users=mysql_query($getUsers);
$numUsers=mysql_num_rows($users);
for ($userLoop = 0; $userLoop < $numUsers; $userLoop++) {
	$user=mysql_result($users,$userLoop,"personKey");
	$name=mysql_result($users,$userLoop,"fName")." ".mysql_result($users,$userLoop,"lName");
	print("<tr>\n");
	print("<th colspan=\"3\" bgcolor=\"#66ffff\">$name</th>\n");
	print("</tr>\n");
	$giftsForPersonQuery="
		select
			g.giftName as gift,
			p.fName as fName,
			p.lName as lName,
			gcb.dateClaimed as date
		from
			person p,
			giftList g,
			giftClaimedBy gcb,
			personWishesForGift pwfg
		where
			g.giftKey = gcb.giftKey and
			p.personKey = gcb.personKey and
			gcb.giftKey = pwfg.giftKey and
			pwfg.personKey = $user";
	$giftsClaimed=mysql_query($giftsForPersonQuery);
	if (!$giftsClaimed) die ("Could not select gift information: <br /><b>$giftsForPersonQuery</b><br />".mysql_error());
	$numClaims=mysql_num_rows($giftsClaimed);
	print ("<tr><th>Gift</th><th>Purchaser</th><th>Date Claimed</th></tr>\n");
	for ($claimLoop = 0; $claimLoop < $numClaims; $claimLoop++) {
		$gift=mysql_result($giftsClaimed,$claimLoop, "gift");
		$name = mysql_result($giftsClaimed,$claimLoop,"fName")." ".mysql_result($giftsClaimed,$claimLoop,"lName");
		$date=mysql_result($giftsClaimed,$claimLoop, "date");
		print("<tr><td>$gift</td><td>$name</td><td>$date</td></tr>\n");
	}
}

?>
Return current item: The Community Wish List Server