本文整理汇总了PHP中Base_model::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Base_model::update方法的具体用法?PHP Base_model::update怎么用?PHP Base_model::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base_model
的用法示例。
在下文中一共展示了Base_model::update方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Actualización de usuario
*/
public function update($params)
{
$this->db->trans_start();
parent::update($params);
$id = $params['id'];
$this->db->query("DELETE FROM materias_usuarios WHERE usuario_id={$id}");
if (isset($params['materias'])) {
foreach ($params['materias'] as $val) {
$this->db->insert('materias_usuarios', array('materia_id' => $val, 'usuario_id' => $id));
}
}
$this->db->trans_complete();
}
示例2: update
public function update($params)
{
$this->db->trans_start();
$curso = $params;
$curso['materias'] = isset($params['materias']) ? count($params['materias']) : 0;
$id = $params['id'];
parent::update($curso);
$this->db->query("DELETE FROM cursos_materias WHERE curso_id={$id}");
if (isset($params['materias'])) {
foreach ($params['materias'] as $val) {
$this->db->insert('cursos_materias', array('curso_id' => $id, 'materia_id' => $val));
}
}
$this->db->trans_complete();
}
示例3: correct_internal_links
public function correct_internal_links($id_article, $id_old_page, $id_page)
{
// Update content links
$old_link_code = '{{article:' . $id_old_page . '.' . $id_article . '}}';
$new_link_code = '{{article:' . $id_page . '.' . $id_article . '}}';
$this->{$this->db_group}->where('content like \'%' . $old_link_code . '%\'');
$query = $this->{$this->db_group}->get($this->lang_table);
if ($query->num_rows() > 0) {
$articles = $query->result_array();
foreach ($articles as $article) {
$content = $article['content'];
$content = str_replace($old_link_code, $new_link_code, $content);
$this->{$this->db_group}->where(array('id_article' => $article['id_article'], 'lang' => $article['lang']));
$this->{$this->db_group}->update($this->lang_table, array('content' => $content));
}
}
// Update internal links
parent::update(array('link_id' => $id_old_page . '.' . $id_article), array('link_id' => $id_page . '.' . $id_article), $this->parent_table);
}
示例4: update
public function update($id, $data, $pot = '')
{
$this->switching($this->_idx_table, $pot);
return parent::update($id, $data);
}
示例5: mod_user_pwd
/**
* @修改密码
* @param mobile string 帐号即手机号
* @return <boolean, string>
*/
public function mod_user_pwd($data = array())
{
if (empty($data['mobile']) || empty($data['password'])) {
return false;
}
//验证手机号码是否存在
$user = $this->get_uid_by_mobile($data['mobile']);
if (empty($user)) {
return false;
}
//生成密码
$pwd = md5_passwd($user['salt'], $data['password']);
$result = parent::update($user['uid'], array('password' => $pwd));
if (!empty($result)) {
return $result;
} else {
return false;
}
}
示例6: update
/**
* Actualización de usuario
*/
public function update($params)
{
$this->db->trans_start();
parent::update($params);
$this->db->trans_complete();
}
示例7: create_notification
public function create_notification($title, $message, $code = NULL, $category = NULL, $update = FALSE)
{
$category = is_null($category) ? 'Message' : $category;
$code = is_null($code) ? 'ionize' : $code;
$done = false;
$where = array('title' => $title, 'category' => $category, 'code' => $code, 'read' => '0');
$data = array('date_creation' => date('Y-m-d H:i:s'), 'content' => $message);
if ($update) {
$existing = parent::get_row_array($where);
if (!empty($existing)) {
parent::update($where, $data);
$done = TRUE;
}
}
if (!$done) {
$data = array_merge($where, $data);
parent::insert($data);
}
}