本文整理匯總了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);
}
}