Location: PHPKode > scripts > ER Manager > ermanager/edit_note.php
<?PHP

require "functions.php";

localnet_or_die(); //check for localnet

//save data
if($save) {
	//prepare data
	$SETS = "
		company_id      = '".addslashes($company_id)."',
		note_title      = '".addslashes($note_title)."',
		note      = '".addslashes($note)."',
		date      = '$year-$month-$day'
	";

if($id) {	
	  //update existing record
		$INSERT = "UPDATE er_notes SET ".$SETS." WHERE id = ".$id."";
		runSQL($INSERT);
	} else {
$INSERT = "INSERT INTO er_notes SET ".$SETS." ";
runSQL($INSERT); 

//get id for inserted data
$SELECT = "SELECT id from er_notes ORDER BY id desc LIMIT 1";
$result = runSQL($SELECT);
$id = $result[0][id];
} // end else
		
} // end if($save)

if( ($id and !$save) or !$id) {

//load existing data
if($id and !$save) {
	$SELECT = "SELECT * FROM er_notes WHERE id = ".$id."";
	$entity = runSQL($SELECT);
}

//prepare templates
$smarty->assign('http_error',$CLIENTERROR);
tpl_header();
tpl_edit($entity);
tpl_footer();

//display templates
$smarty->display('header.tpl');
flush();
$smarty->display('edit_note.tpl');
$smarty->display('footer.tpl');

} //end if($id and !save)

else {
  $id = $company_id;
  require "company.php";
}

?>
Return current item: ER Manager