Location: PHPKode > projects > Mozart > Mozart-0.0.4/delproject.php
<?
include("connect.inc");
include("reqlogin.inc");
include("userprefs.inc");
?>
<html>
<title>Mozart: Delete Project</title>
<body bgcolor=<? echo $bgcolor ?> text=<? echo $txtcolor ?>>
<?
include("links.inc");
?>
The following has been selected for deletion:<br><br>
<?
$ProjectSQL = "SELECT * FROM project WHERE proj_id=$id"; 
$Project    = mysql_query($ProjectSQL); 
$myrow      = mysql_fetch_array($Project);

// get TYPE associated with this PROJECT
$type    = $myrow["type"];
$TypeSQL = "SELECT type_name FROM types WHERE type_id = '$type'";
$Type    = mysql_query($TypeSQL);
$typerow = mysql_fetch_array($Type);

// get status from TYPE table associated with the PROJECT
$status    = $myrow["status"];
$StatusSQL = "SELECT type_name FROM types WHERE type_id = '$status'";
$Status    = mysql_query($StatusSQL);
$statusrow = mysql_fetch_array($Status);

print("<table border=0 cellspacing=0 cellpadding=5>");
printf("<tr><td><b>Name</b></td><td><i>%s</i></td></tr>", $myrow["name"]); 
printf("<tr><td><b>Number</b></td><td>%s</td></tr>", $myrow["number"]);
printf("<tr><td><b>Status</b></td><td>%s</td></tr>", $statusrow["type_name"]);
printf("<tr><td><b>Type</b></td><td>%s</td></tr>", $typerow["type_name"]);
printf("<tr><td><b>Opened</b></td><td>%s-%s-%s</td></tr>", $myrow["mon_opened"], $myrow["day_opened"], $myrow["yr_opened"]);

if ($myrow["mon_closed"]) {
    printf("<tr><td><b>Closed</b></td><td>%s-%s-%s</td></tr>", $myrow["mon_closed"], $myrow["day_closed"], $myrow["yr_closed"]);
}

printf("<tr><td><b>Notes</b></td><td>%s</td></tr>", $myrow["notes"]);
print("</table>");
?>
<br><br>
<b>Contacts associated with this project:</b>
<br>
<?
// get project owner name
$proj_owner = $myrow["owner"];
$ProjOwnerSQL = "SELECT last, first FROM contact WHERE contact_id = '$proj_owner'";
$ProjOwner    = mysql_query($ProjOwnerSQL);
$projowner    = mysql_fetch_array($ProjOwner);
printf("<b>Project Owner: </b><a href=\"display.php?id=%s\">%s, %s</a><br>", $proj_owner, $projowner["last"], $projowner["first"]);

// get associated contacts
$ContXProjSQL = "SELECT contact_id, last, first FROM contact, contxproj WHERE xproj_id = '$id' AND contact_id = xcont_id";
$ContXProj    = mysql_query($ContXProjSQL);
if ($contxproj = mysql_fetch_array($ContXProj)) {
   print("<br><b>Other Contacts:</b><br>");
   printf("<a href=\"display.php?id=%s\">%s, %s</a><br>", $contxproj["contact_id"], $contxproj["last"], $contxproj["first"]);
   while ($contxproj = mysql_fetch_array($ContXProj)) {
      printf("<a href=\"display.php?id=%s\">%s, %s</a><br>", $contxproj["contact_id"], $contxproj["last"], $contxproj["first"]);
   }
}
?>
<br>
<?
// get all active associated To Do items
include("todoBYproj.inc");
?>
<br><br>
<?
// get all associated appointments
include("getallappts.inc");
?>
<br><br>
Pressing Delete will <i>completely</i> remove this project and the associated To Do items and Appointments from the system.
<br><br>
<?
printf("<form action=\"deleteprj.php?id=%s\" method=\"post\">", $id);
?>
<input type="submit" value="Delete">
</form>
<?
include("links.inc");
?>
</body>
</html>
Return current item: Mozart