当前位置: 首页>>代码示例>>PHP>>正文


PHP Staff::update方法代码示例

本文整理汇总了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>";
    }
}
?>
开发者ID:nathanashton,项目名称:GuestBook,代码行数:31,代码来源:editstaff.php

示例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.
开发者ID:hungnv0789,项目名称:vhtm,代码行数:31,代码来源:admin.php

示例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.";
                }
开发者ID:jlt1288,项目名称:CIS470_TPSWS,代码行数:31,代码来源:staff.php


注:本文中的Staff::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。