$sql_all = "select * from employee order by id ";
$rs_all = $db->Execute($sql_all);
$smarty->assign('employee_all', $rs_all);
if(($_GET['action'] == "update") && ($_GET['id'] !="")){
$sql = "select * from employee where id =".$_GET['id'];
$rs = $db->Execute($sql);
$smarty->assign('employee', $rs);
}
if($_GET['action'] == "add"){
$rs = $db->Execute('select * from employee where id = -1');
$insertSQL = $db->GetInsertSQL($rs, $record);
$db->Execute($insertSQL);
redirect('employee.php');
}else if(($_POST['action'] == "update") && ($_GET['id'] !="")){
$sql = "select * from employee where id =".$_GET['id'];
$rs = $db->Execute($sql);
$smarty->assign('employee', $rs);
$rs = $db->Execute('select * from employee where id ='.$_GET['id']);
$updateSQL = $db->GetUpdateSQL($rs, $record);
$db->Execute($updateSQL);
redirect('employee.php');
}else if($_GET['action'] == "delete"){
$db->Execute('delete from employee where id ='.$_GET['id']);
redirect('employee.php');
}