本文整理汇总了PHP中Staff::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Staff::update方法的具体用法?PHP Staff::update怎么用?PHP Staff::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Staff
的用法示例。
在下文中一共展示了Staff::update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Database
include "../config/database.class.php";
include "../objects/staff.class.php";
$database = new Database();
$db = $database->getConnection();
$originalOption = new Staff($db);
if (isset($_GET['id'])) {
$id = $_GET['id'];
$originalOption->Id = $id;
$originalOption->selectById();
}
if (isset($_POST['update'])) {
$updatedOption = new Staff($db);
$updatedOption->Id = $_POST['id'];
$updatedOption->FirstName = $_POST['firstname'];
$updatedOption->LastName = $_POST['lastname'];
if ($updatedOption->update() == true) {
header("location:staff.php");
} else {
echo "<script>alert('There was an error updating this item');window.location = 'staff.php' </script>";
}
}
if (isset($_POST['delete'])) {
$updatedOption = new Staff($db);
$updatedOption->Id = $_POST['id'];
if ($updatedOption->delete() == true) {
header("location:staff.php");
} else {
echo "<script>alert('There was an error deleting this item');window.location = 'staff.php' </script>";
}
}
?>
示例2: switch
$errors['err']='Uknown command!';
}
}else{
$errors['err']='No groups selected.';
}
}
break;
case 'staff':
include_once(INCLUDE_DIR.'class.staff.php');
$do=strtolower($_POST['do']);
switch($do){
case 'update':
$staff = new Staff($_POST['staff_id']);
if($staff && $staff->getId()) {
if($staff->update($_POST,$errors))
$msg='Staff profile updated successfully';
elseif(!$errors['err'])
$errors['err']='Error updating the user';
}else{
$errors['err']='Internal error';
}
break;
case 'create':
if(($uID=Staff::create($_POST,$errors)))
$msg=Format::htmlchars($_POST['firstname'].' '.$_POST['lastname']).' added successfully';
elseif(!$errors['err'])
$errors['err']='Unable to add the user. Internal error';
break;
case 'mass_process':
//ok..at this point..look WMA.
示例3: elseif
}
$staff->refresh();
} elseif (isset($_POST['type']) && $_POST['type'] === "info") {
// Looks like we're trying to update our staffing information in the database.
$id = $_SESSION['id'];
$staff->available = $_POST['available'];
$staff->Fname = $_POST['Fname'];
$staff->Lname = $_POST['Lname'];
$staff->city = $_POST['city'];
$staff->state = $_POST['state'];
$staff->zip = $_POST['zip'];
$staff->workType = $_POST['workType'];
$staff->experience = $_POST['experience'];
$staff->education = $_POST['education'];
$staff->salary = $_POST['salary'];
if ($staff->update()) {
$message = "Information was successfully updated.";
} else {
$message = "Encountered an error. Information could not be updated.";
}
} elseif (isset($_POST['type']) && $_POST['type'] === "account") {
// Looks like we're trying to update our account information in the database.
if (isset($_POST['current_pwd'])) {
$user = new User($_SESSION['id'], $_POST['current_pwd'], "id");
// Only allow information to be changed if we can log in with the account.
if ($user->isLoggedIn) {
if (isset($_POST['email'])) {
$email = $_POST['email'];
if ($user->update("Email", trim($_POST['email']))) {
$message = "Email address has been successfully changed.";
}