Location: PHPKode > projects > Mozart > Mozart-0.0.4/updateprj.php
<?
// called from: updproject.php
// description: updates on PROJECT information
//
include("connect.inc");
include("reqlogin.inc");

// Update Contact table 
$UpdProjectSQL = "UPDATE project SET name = '$ProjectName', number = '$ProjectNumber', type = '$ProjectType', status = '$ProjectStatus', notes = '$ProjectNotes', owner = '$ForUser' WHERE proj_id = '$id'";
$UpdContact = mysql_query($UpdProjectSQL);

$Message = "Project Successfully Updated";

$errno = mysql_errno($db);
$error = mysql_error($db);
if ($errno != 0) {
    $Message = "In updateprj.php at project $errno: $error";
    include("projectlist.php");
    exit;
}

$GetUserXProjSQL = "SELECT userxproj_id FROM userxproj WHERE xproj_id = '$id'";
$GetUserXProj = mysql_query($GetUserXProjSQL);
$getuserxproj = mysql_fetch_array($GetUserXProj);

// if cross-reference exists, update it
if ($getuserxproj["userxproj_id"]) {
    $xid = $getuserxproj["userxproj_id"];
    $UserXProjSQL = "UPDATE userxproj SET xuser_id = '$ForUser' WHERE userxproj_id = '$xid' AND xproj_id = '$id'";
}
// else cross-reference doesn't exist, so create it
else {
    $UserXProjSQL = "INSERT INTO userxproj (userxproj_id, xuser_id, xproj_id) VALUES (NULL, '$ForUser', '$id')";
}
$UserXProj = mysql_query($UserXProjSQL);

$errno = mysql_errno($db);
$error = mysql_error($db);
if (!($errno == 0)) {
    $Message = "In updateprj.php at userxproj - Error $errno: $error";
    include("projectlist.php");
    exit;
}

$GetContXProjSQL = "SELECT contxproj_id FROM contxproj WHERE xproj_id = '$id'";
$GetContXProj = mysql_query($GetContXProjSQL);
$getcontxproj = mysql_fetch_array($GetContXProj);

// if cross-reference exists, update it
if ($getcontxproj["contxproj_id"]) {
    $xid = $getcontxproj["contxproj_id"];
    $ContXProjSQL = "UPDATE contxproj SET xcont_id = '$SelContact' WHERE contxproj_id = '$xid' AND xproj_id = '$id'";
}
// else cross-reference doesn't exist, so create it
else {
    $ContXProjSQL = "INSERT INTO contxproj (contxproj_id, xcont_id, xproj_id) VALUES (NULL, '$SelContact', '$id')";
}
$ContXProj = mysql_query($ContXProjSQL);

$errno = mysql_errno($db);
$error = mysql_error($db);
if (!($errno == 0)) {
    $Message = "In updateprj.php at contxproj - Error $errno: $error";
    include("projectlist.php");
    exit;
}

include("projectlist.php")
?>
Return current item: Mozart