本文整理汇总了PHP中Sql::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Sql::update方法的具体用法?PHP Sql::update怎么用?PHP Sql::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sql
的用法示例。
在下文中一共展示了Sql::update方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resetPassword
static function resetPassword($data)
{
PDOSql::$pdobj = pdoConnect();
$hash = Sql::esc($data['h']);
$type = Sql::esc($data['t']);
$email = Sql::esc($data['q']);
$pass1 = Sql::esc($data['pass1']);
$pass2 = Sql::esc($data['pass2']);
if ($pass1 !== $pass2) {
return array('success' => false, 'data' => '', 'msg' => 'Las contraseñas no coinciden');
}
if ($type == 'C') {
$get_hash = "SELECT id, email, resetHash from clientes where email ='" . $email . "' AND resetHash = '" . $hash . "'";
$delete_hash = "UPDATE clientes set password = MD5('" . $pass1 . "'), resetHash = null where email ='" . $email . "' AND resetHash = '" . $hash . "'";
} elseif ($type == 'U') {
$get_hash = "SELECT id, email, resetHash from usuarios where email ='" . $email . "' AND resetHash = '" . $hash . "'";
$delete_hash = "UPDATE usuarios set password = MD5('" . $pass1 . "'), resetHash = null where email ='" . $email . "' AND resetHash = '" . $hash . "'";
} else {
return array('success' => false, 'data' => '', 'msg' => 'Problema con el reseteo');
}
$h = Sql::fetch($get_hash);
if (count($h) == 1) {
$u = Sql::update($delete_hash);
return array('success' => true, 'data' => array('id' => $h[0]['id']), 'msg' => 'Se realizo la operacion con exito.');
} else {
return array('success' => false, 'data' => '', 'msg' => 'Codigo invalido');
}
}
示例2: save
/**
* Save Tag
* @return bollean
*/
public function save()
{
$data = array(self::ID_TAG => $this->getIdTag(), self::TAG => $this->getTag());
$sql = new Sql();
if (is_null($this->getIdTag())) {
$sql->insert($data, self::TABLE);
$this->idTag = $sql->lastRow(self::TABLE)->id_tag;
return true;
} else {
$pk = array(self::ID_TAG => $this->getIdTag());
return $sql->update($data, self::TABLE, $pk);
}
}
示例3: save
/**
* Save
* @return bollean
*/
public function save()
{
$data = array(self::ISOLANG => $this->getIsoLang(), self::DEFAULT_CULTURE => $this->getDefault());
$sql = new Sql();
if (!self::hasCulture($this->getIsoLang())) {
$sql->insert($data, self::TABLE);
$this->isolang = $sql->lastRow(self::TABLE)->isolang;
return true;
} else {
$pk = array(self::ISOLANG => $this->getIsoLang());
return $sql->update($data, self::TABLE, $pk);
}
}
示例4: save
/**
* Save Log
* @return bollean
*/
public function save()
{
$data = array(self::ID => self::getId(), self::DATE => self::getDate(), self::FILE => self::getFile(), self::MESSAGE => self::getMessage(), self::IS_ERROR => self::getIsError());
$sql = new Sql();
if (is_null($this->getId())) {
$sql->insert($data, self::TABLE);
$this->id = $sql->lastRow(self::TABLE)->id;
return true;
} else {
$pk = array(self::ID => self::getId());
return $sql->update($data, self::TABLE, $pk);
}
}
示例5: update
static function update($table, $data, $where = '', $connection = 'default')
{
return static::query(\Sql::update($table, $data, $where), $connection);
}
示例6: action_move_folder
function action_move_folder($id_folder, $id_parent)
{
Sql::update('folders', array('id_parent' => $id_parent), 'id = ?', $id_folder);
}
示例7: deshabilitarCategoria
static function deshabilitarCategoria($id)
{
$tbl_name = "custom_cats_" . $_SESSION['clientID'];
PDOSql::$pdobj = pdoConnect();
$id = Sql::esc($id);
$u = Sql::update("UPDATE {$tbl_name} SET activo = 0 WHERE id = '" . $id . "'");
if ($u > 0) {
return array('success' => true, 'data' => array(), 'msg' => 'Se deshabilitó la categoría personalizada');
}
}
示例8: save
/**
* Save Tag
* @return bollean
*/
public function save()
{
$data = array(self::ID_TAG_I18N => $this->getIdTagI18n(), self::ID_TAG => $this->getIdTag(), self::ISOLANG => $this->getIsoLang(), self::TRANSLATE => $this->getTranslate());
$sql = new Sql();
if (is_null($this->getIdTagI18n())) {
$sql->insert($data, self::TABLE);
$this->idTagI18n = $sql->lastRow(self::TABLE) ? $sql->lastRow(self::TABLE)->id_tag_i18n : '';
$this->idTag = $sql->lastRow(self::TABLE) ? $sql->lastRow(self::TABLE)->id_tag : '';
return true;
} else {
$pk = array(self::ID_TAG_I18N => $this->getIdTagI18n());
return $sql->update($data, self::TABLE, $pk);
}
}