
|

America's Most-Generous Donors
printSearchTable($dbLink, $Profession_type, Recipient_type, $State, $year, $chosen);
?>
if ($year == "")
{
$year = "2006";
}
if (($year != "2005") && ($year != "2004") && ($year != "2003") && ($year != "2002") && ($year != "2001") && ($year != "2000"))
{
$year = "2006";
}
while ($first == 0)
{
$query = "SELECT DISTINCT Slate_gifts.ID_gift, Slate_gifts.Rank_slate, Slate_gifts.Year, Slate_names.Name_full, YearBorn, Slate_names.Profession_type, Slate_names.City, Slate_names.State, Total_gifts, Total_pledged, Total_paid, Num_gifts, Num_pledged, Num_paid, Gift_brief, Paid_detail, Pledge_detail FROM Slate_gifts, Slate_names WHERE (Slate_names.ID_Name=\"$ID_Gift\") AND (Slate_gifts.ID_Gift=Slate_names.ID_Name) AND (Slate_gifts.Year='$year') ORDER BY Slate_gifts.Year DESC";
# echo $query;
$mysql_result = mysql_query($query, $dbLink);
$num = mysql_num_rows($mysql_result);
while ($row = mysql_fetch_object($mysql_result))
{
if ($first == 0)
{
$first = 1;
# printYearDetailTable($dbLink, $year, $ID_Gift);
?>
# $query2 = "SELECT DISTINCT Name_full, YearBorn FROM Slate_names, Slate_donors, Slate_gifts WHERE (Slate_gifts.ID_Gift=\"$ID_Gift\") AND (Slate_gifts.Year=\"$row->Year\") AND (Slate_gifts.ID_Gift=Slate_donors.ID_Gift) AND (Slate_names.ID_Name=Slate_donors.ID_Name) ORDER BY Slate_gifts.Year DESC";
$yearm = $year-1;
$query2 = "select Slate_names.Name_full, Slate_names.YearBorn from Slate_gifts left join Slate_donors on Slate_gifts.ID_Gift = Slate_donors.ID_Gift left join Slate_names on Slate_donors.ID_Name = Slate_names.ID_Name where Slate_gifts.Year='{$year}' and Slate_donors.Year='{$yearm}' and Slate_gifts.ID_Gift = '{$ID_Gift}'";
# print "$query2 ";
$mysql_result2 = mysql_query($query2, $dbLink);
while ($row2 = mysql_fetch_object($mysql_result2))
{
if ($namefirst == 0)
{
$namefirst = 1;
print "| \n";
print "Rank: $row->Rank_slate\n";
print " | \n";
print "\n";
print "$row2->Name_full";
print " | \n";
}
else
{
print " \n";
print "\n";
print " | \n";
print "$row2->Name_full | ";
print " \n";
}
}
if ($namefirst == 1)
{
print " \n";
}
?>
|
|
Total donated or pledged in print "$row->Year"; ?>: print "\$" . number_format($row->Num_gifts); ?>
|
$query2 = "SELECT count(*) AS count_years FROM Slate_gifts, Slate_names WHERE (Slate_names.ID_Name=\"$ID_Gift\") AND (Slate_gifts.ID_Gift=Slate_names.ID_Name)";
# print "$query2
\n";
$mysql_result2 = mysql_query($query2, $dbLink);
while ($row2 = mysql_fetch_object($mysql_result2))
{
$count_years = $row2->count_years;
}
if ($count_years > 1)
{
# $query3 = "SELECT SUM(Slate_gifts.Num_gifts) AS sum FROM Slate_gifts, Slate_donors, Slate_names WHERE (Slate_names.ID_Name=\"$ID_Name\") AND (Slate_donors.ID_Name=Slate_names.ID_Name) AND (Slate_donors.ID_Gift=Slate_gifts.ID_Gift)";
$query3 = "SELECT SUM(Slate_gifts.Num_gifts) AS sum FROM Slate_gifts, Slate_names WHERE (Slate_names.ID_Name=\"$ID_Gift\") AND (Slate_gifts.ID_Gift=Slate_names.ID_Name)";
# print "$query3
\n";
$mysql_result3 = mysql_query($query3, $dbLink);
while ($row3 = mysql_fetch_object($mysql_result3))
{
$sum = $row3->sum;
}
?>
|
Total donated or pledged in years they appeared in The Chronicle's rankings: print "\$" . number_format($sum); ?>
|
}
?>
|
if ($row->State == "") print "$row->City"; else print "$row->City, State&year=$year&chosen=State\">$row->State"; ?>
|
|
Source of wealth:
$PType = split(", ", $row->Profession_type);
foreach ($PType as $value)
{
if ($pfirst == 0)
{
$pfirst = 1;
print "$value";
}
else
{
print ", $value";
}
}
?>
|
|
|
$query2 = "SELECT DISTINCT Slate_gifts.ID_gift, Slate_gifts.Year, Slate_gifts.Total_paid, Slate_gifts.Total_pledged, Slate_gifts.Total_gifts FROM Slate_gifts, Slate_donors, Slate_names WHERE (Slate_names.ID_Name=\"$ID_Gift\") AND (Slate_donors.ID_Name=Slate_names.ID_Name) AND (Slate_donors.ID_Gift=Slate_gifts.ID_Gift) ORDER BY Slate_gifts.Year DESC";
# print "$query2
\n";
$mysql_result2 = mysql_query($query2, $dbLink);
while ($row2 = mysql_fetch_object($mysql_result2))
{
?>
if ($row2->Year == $year) print ""; print "$row2->Year"; if ($row2->Year == $year) print "";?> |
print "$row2->Total_gifts"; ?> |
n/a |
}
?>
|
if($naflag!=0) echo "n/a Not available.
";
if ($row->Gift_brief != "")
{
print " Gift overview in $year\n";
print " $row->Gift_brief \n";
}
if ($row->Paid_detail != "")
{
print " Donations in $year\n";
print " $row->Paid_detail \n";
}
if ($row->Pledge_detail != "")
{
print " Pledges in $year\n";
print " $row->Pledge_detail \n";
}
?>
|
}
}
if ($first == 0)
{
if ($year == 2000)
{
break;
}
else
{
$year--;
}
}
}
?>
Copyright © 2006 The Chronicle of Philanthropy
|

|

|