" target="_blank"> |
Add New Relation |
|
| |
With this tool you can administer all different types of relations related to you DNA and tissue samples or specimen data.
Below the green box you can see all records found in the database. It is not possible to delete entries here. To do so please ask your administrator for assistance. After finishing your entries please close this window and reload (F5) the input or search mask
to get the updated list from database. |
| Sorry, as a guest you don't have permission for entering new data! If you want to search for existing DNA data please use the Search function! | "; }
else {
if($formSubmitSave)
{
if(empty($formNewRelation))
{ unset($formNewRelation); }
if($formNewRelation=="")
{ echo "Please complete 'Relation'"; }
if($formNewRelation!="")
{
$result= mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_Relation, Relation FROM relation " .
"WHERE Relation = '$formNewRelation'");
if(mysqli_num_rows($result))
{
echo "Relation already exists!";
}
else
{
$NewRelation = addslashes($formNewRelation);
$RelationRemarks = addslashes($formRelationRemarks);
$sqlref = "SELECT * FROM reference WHERE ReferenceText = '$formReference' OR ReferenceShort = '$formReference'";
$resultref = mysqli_query($GLOBALS["___mysqli_ston"], $sqlref);
while($row = mysqli_fetch_object($resultref))
{ $ID_Ref = "'".$row->ID_References."'";}
if(!isset($ID_Ref)) { $ID_Ref = 'NULL'; }
$sql = "INSERT INTO relation (Relation, RelationRemarks, FK_Reference, Created_Who)" .
"VALUES ('$NewRelation','$RelationRemarks',$ID_Ref,'$log')";
$result = mysqli_query($GLOBALS["___mysqli_ston"], $sql);
#######################################Error 1###############################################################
if(!$result)
{ $msg = $sql."\n";
$msg .= "####Error 1####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
/**
* calling Error message
*/
include ("../config/Errorreport.php"); }
#############################################################################################################
else {
include("../config/DataSaved.php"); }
}
}
}//if ($formSubmitSave)
if($formSubmitUpdate)
{
$NewRelation = addslashes($formNewRelation);
$NewRelationRemarks = addslashes($formRelationRemarks);
$ID_Relation = $_POST['ID_Relation'];
$Current_Date = date('Y-m-d H:i:s');
if($formReference != "") {
$sqlref = "SELECT * FROM reference WHERE ReferenceText = '$formReference' OR ReferenceShort = '$formReference'";
$resultref = mysqli_query($GLOBALS["___mysqli_ston"], $sqlref);
while($row = mysqli_fetch_object($resultref))
{ $ID_Ref = "'".$row->ID_References."'"; }
if(!isset($ID_Ref)) { $ID_Ref = 'NULL'; } }
else { $ID_Ref = 'NULL'; }
$sql = "UPDATE relation SET Relation = '$NewRelation', RelationRemarks = '$NewRelationRemarks', FK_Reference = $ID_Ref, Updated_Who = '$log', Updated_When = '$Current_Date' WHERE ID_Relation = '$ID_Relation'";
$result = mysqli_query($GLOBALS["___mysqli_ston"], $sql);
#######################################Error 2###############################################################
if(!$result)
{ $msg = $result."\n";
$msg .= "####Error 2####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
/**
* calling Error message
*/
include ("../config/Errorreport.php"); }
#############################################################################################################
else {
include("../config/ChangesAccepted.php"); }
} //if ($formSubmitUpdate)
?>
";
if($num_rows > 0) {
echo " |
|
";
echo"Relation | Reference | Created | | ";
while ($row = mysqli_fetch_object($result))
{
echo "".$row->Relation." | ";
if($row->ReferenceUrl != "")
{ echo $row->ReferenceShort ? build_href1($row->ReferenceUrl, $row->ReferenceShort) : build_href1($row->ReferenceUrl, $row->ReferenceText); }
else { echo $row->ReferenceShort ? $row->ReferenceShort : $row->ReferenceText; }
echo " | ".$row->Created_Who." (".$row->Created_When.") | |
";
}
}
else { echo "No relation entries found. |
"; }
((mysqli_free_result($result) || (is_object($result) && (get_class($result) == "mysqli_result"))) ? true : false);
?>