本文整理汇总了PHP中Usuarios::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Usuarios::update方法的具体用法?PHP Usuarios::update怎么用?PHP Usuarios::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Usuarios
的用法示例。
在下文中一共展示了Usuarios::update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modificarAction
public function modificarAction()
{
$this->view->subtitle = $this->info->sitio->usuarios->modificar->titulo;
$eUsuario = new Usuarios();
if ($this->_request->isPost()) {
Zend_Loader::loadClass('Zend_Filter_StripTags');
$filter = new Zend_Filter_StripTags();
$id = (int) $this->_request->getPost('id');
$usuario = trim($filter->filter($this->_request->getPost('usuario')));
$password = trim($filter->filter($this->_request->getPost('password')));
$nombre = trim($filter->filter($this->_request->getPost('nombre')));
$apellido = trim($filter->filter($this->_request->getPost('apellido')));
$mail = trim($filter->filter($this->_request->getPost('mail')));
$estado = trim($filter->filter($this->_request->getPost('estado')));
if ($id !== false) {
if ($usuario != '' && $password != '' && $nombre != '' && $apellido != '' && $mail != '') {
$data = array('usuario' => $usuario, 'password' => md5($password), 'nombre' => $nombre, 'apellido' => $apellido, 'mail' => $mail, 'estado' => $estado);
$where = 'id = ' . $id;
$eUsuario->update($data, $where);
$this->_redirect('/admin/usuarios/');
return;
} else {
$this->view->usuario = $eUsuario->fetchRow('id=' . $id);
$this->view->message = "Deben llenarse todos los campos";
}
}
} else {
$id = (int) $this->_request->getParam('id', 0);
if ($id > 0) {
$this->view->usuario = $eUsuario->fetchRow('id=' . $id);
}
}
$this->view->action = $this->info->sitio->usuarios->modificar->action;
$this->view->buttonText = $this->info->sitio->usuarios->modificar->buttonText;
$this->render();
}
示例2:
<ul class="nav">
<li class="active"><a href="index.php">Página inicial</a></li>
</ul>
</div>
</div>
</nav>
</header>
<?php
if (isset($_POST['atualizar'])) {
$id = $_POST['id'];
$nome = $_POST['nome'];
$email = $_POST['email'];
$usuario->setNome($nome);
$usuario->setEmail($email);
if ($usuario->update($id)) {
echo "Atualizado com sucesso!";
}
}
?>
<?php
if (isset($_GET['acao']) && $_GET['acao'] == 'deletar') {
$id = (int) $_GET['id'];
if ($usuario->delete($id)) {
echo "Deletado com sucesso!";
}
}
?>
<?php
示例3: Exception
$id = http_request("ID", "i", 0);
$user = http_request("Username", "s", null);
$pass = http_request("Password", "s", null);
$sid = http_request("Session", "i", 0);
$sk = http_request("SessionKey", "s", "");
if ($operation === null) {
throw new Exception("Call to userFunctions without 'Operation' requested");
}
switch ($operation) {
case "insert":
$am->access(PERMS_ADMIN);
$result = $users->insert();
break;
case "update":
$am->access(PERMS_ADMIN);
$result = $users->update($id);
break;
case "delete":
$am->access(PERMS_ADMIN);
$result = $users->delete($id);
break;
case "password":
$result = $am->setPassword($id, $pass, $sk);
break;
// access checks are done inside method
// access checks are done inside method
case "selectbyid":
$result = $users->selectByID($id);
break;
case "select":
$result = $users->select();
示例4: Usuarios
<?php
require_once 'variaveis.php';
require_once 'core/Usuarios.php';
$user = new Usuarios();
if (isset($_GET['del'])) {
$user->setId_usuario($_GET['del']);
$user->delete();
}
if (isset($_GET['edit'])) {
$user->setUsuario($_GET['edit']);
$user->update();
}
if (isset($_POST['usuario']) and isset($_POST['nome']) and isset($_POST['senha']) and isset($_POST['tipo']) and !isset($_GET['editar'])) {
$user->setNome($_POST['nome']);
$user->setUsuario($_POST['usuario']);
$user->setSenha(md5($_POST['senha']));
$user->setId_tipo($_POST['tipo']);
$user->insert();
}
$smarty->assign("lista", $user->select());
$smarty->assign("nome", "Usuários");
$smarty->display("usuarios.tpl");