<?
// called from: updproject.php
// description: updates on PROJECT information
//
include("connect.inc");
include("reqlogin.inc");
// Get current date
$current = getdate();
$currmon = $current["mon"];
$currday = $current["mday"];
$curryr = $current["year"];
// Insert PROJECT
$InsProjectSQL = "INSERT INTO project (proj_id, name, number, type, status, notes, owner, mon_opened, day_opened, yr_opened) VALUES (NULL, '$ProjectName', '$ProjectNumber', '$ProjectType', '$ProjectStatus', '$ProjectNotes', '$ForUser', '$currmon', '$currday', '$curryr')";
$InsProject = mysql_query($InsProjectSQL);
$NewProjID = mysql_insert_id($db);
$Message = "New Project Successfully Added";
$errno = mysql_errno($db);
$error = mysql_error($db);
if ($errno != 0) {
$Message="In insproject.php at project - $errno: $error";
include("projectlist.php");
exit;
}
// Create user cross-reference entry
$InsUserXProjSQL = "INSERT INTO userxproj (userxproj_id, xuser_id, xproj_id) VALUES (NULL, '$ForUser', '$NewProjID')";
$InsUserXProj = mysql_query($InsUserXProjSQL);
$errno = mysql_errno($db);
$error = mysql_error($db);
if ($errno != 0) {
$Message="In insproject.php at userxproj - $errno: $error";
include("projectlist.php");
exit;
}
// create contact cross-reference entry
$InsContXProjSQL = "INSERT INTO contxproj (contxproj_id, xcont_id, xproj_id, client_flag) VALUES (NULL, '$SelContact', '$NewProjID', 'Y')";
$InsContXProj = mysql_query($InsContXProjSQL);
$errno = mysql_errno($db);
$error = mysql_error($db);
if ($errno != 0) {
$Message="In insproject.php at contxproj - $errno: $error";
include("projectlist.php");
exit;
}
include("projectlist.php");
?>