本文整理汇总了PHP中Sql::pUpdate方法的典型用法代码示例。如果您正苦于以下问题:PHP Sql::pUpdate方法的具体用法?PHP Sql::pUpdate怎么用?PHP Sql::pUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sql
的用法示例。
在下文中一共展示了Sql::pUpdate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write
public function write($id, $data)
{
$time = time() + $this->expire_time;
$q = 'REPLACE tblSessionData (session_id,session_data,expires) VALUES(?, ?, ?)';
Sql::pUpdate($q, 'sss', $id, $data, sql_datetime($time));
return true;
}
示例2: store
public function store()
{
$q = 'SELECT id FROM ' . self::$tbl_name . ' WHERE owner = ? AND season = ? AND episode = ?';
$this->id = Sql::pSelectItem($q, 'iii', $this->owner, $this->season, $this->episode);
if ($this->id) {
$q = 'UPDATE ' . self::$tbl_name . ' SET owner = ?, title = ?, date = ?, info = ?, season = ?, episode = ?, link = ? WHERE id = ?';
Sql::pUpdate($q, 'isssiisi', $this->owner, $this->title, $this->date, $this->info, $this->season, $this->episode, $this->link, $this->id);
return $this->id;
}
$q = 'INSERT INTO ' . self::$tbl_name . ' SET owner = ?, title = ?, date = ?, info = ?, season = ?, episode = ?, link = ?';
return Sql::pInsert($q, 'isssiis', $this->owner, $this->title, $this->date, $this->info, $this->season, $this->episode, $this->link);
}
示例3: set
public static function set($type, $owner, $name, $val)
{
$q = 'SELECT id FROM ' . self::$tbl_name . ' WHERE owner = ? AND type = ? AND name = ?';
if (Sql::pSelectItem($q, 'iis', $owner, $type, $name)) {
$q = 'UPDATE ' . self::$tbl_name . ' SET time_saved = NOW(), value = ?' . ' WHERE owner = ? AND type = ? AND name = ?';
Sql::pUpdate($q, 'siis', $val, $owner, $type, $name);
} else {
$q = 'INSERT INTO ' . self::$tbl_name . ' SET time_saved = NOW(),' . 'owner = ?, type = ?, name = ?, value = ?';
Sql::pInsert($q, 'iiss', $owner, $type, $name, $val);
}
return true;
}
示例4: sync
/** Updates tblFiles entry with current file size & mime type, useful after Image resize / rotate etc */
public static function sync($id)
{
$name = self::getUploadPath($id);
if (!file_exists($name)) {
throw new \Exception('cant sync nonexisting file, what do???');
}
$size = filesize($name);
$mime = get_mimetype_of_file($name);
$q = 'UPDATE tblFiles' . ' SET size = ?, mimetype = ?' . ' WHERE id = ?';
Sql::pUpdate($q, 'isi', $size, $mime, $id);
}
示例5: logout
/** Logs out the user */
function logout()
{
dp($this->username . ' logged out');
if (!$this->id) {
throw new \Exception('already logged out');
}
Sql::pUpdate('UPDATE tblUsers SET time_last_logout = NOW() WHERE id = ?', 'i', $this->id);
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 604800, $params['path'], $params['domain'], $params['secure'], $params['httponly']);
$page = XmlDocumentHandler::getInstance();
$show_page = $this->logged_out_start_page ? $this->logged_out_start_page : $page->getRelativeUrl();
header('Location: ' . $show_page);
$this->end();
die;
}
示例6: remove
/**
* Marks specified user as "deleted"
*/
public function remove()
{
// also removes user from all user groups
foreach (UserGroupHandler::getGroups($this->id) as $grp) {
UserGroupHandler::removeFromGroup($this->id, $grp->id);
}
$q = 'UPDATE tblUsers SET time_deleted = NOW() WHERE id = ?';
Sql::pUpdate($q, 'i', $this->id);
}
示例7: save
function save()
{
$session = SessionHandler::getInstance();
if (!$this->id) {
$q = 'SELECT groupId FROM tblUserGroups WHERE name = ?';
$this->id = Sql::pSelectItem($q, 's', $this->name);
}
if ($this->id) {
$q = 'UPDATE tblUserGroups SET name = ?, info = ?, level = ? WHERE groupId = ?';
Sql::pUpdate($q, 'ssii', $this->name, $this->info, $this->level, $this->id);
} else {
$q = 'INSERT INTO tblUserGroups SET createdBy = ?, timeCreated = NOW(), name = ?, info = ?, level = ?';
$this->id = Sql::pInsert($q, 'issi', $session->id, $this->name, $this->info, $this->level);
}
return $this->id;
}
示例8: updateId
public static function updateId($obj, $tblname, $field_name = 'id')
{
if (!is_alphanumeric($tblname) || !is_alphanumeric($field_name)) {
throw new \Exception('very bad');
}
if (!$obj->{$field_name}) {
d($obj);
throw new \Exception('eehh');
}
$reflect = self::reflectQuery($obj, $field_name);
$q = 'UPDATE ' . $tblname . ' SET ' . implode(', ', $reflect->cols) . ' WHERE ' . $field_name . ' = ?';
$reflect->str .= is_numeric($obj->{$field_name}) ? 'i' : 's';
$reflect->vals[] = $obj->{$field_name};
return Sql::pUpdate($q, $reflect->str, $reflect->vals);
}
示例9: deleteByOwner
public static function deleteByOwner($type, $owner)
{
$session = SessionHandler::getInstance();
$q = 'UPDATE ' . self::$tbl_name . ' SET deleted_by = ?, time_deleted = NOW()' . ' WHERE type = ? AND owner = ?';
Sql::pUpdate($q, 'iii', $session->id, $type, $owner);
}
示例10: removePoll
static function removePoll($id)
{
$session = SessionHandler::getInstance();
$q = 'UPDATE tblPolls SET deleted_by = ?, time_deleted = NOW() WHERE id = ?';
Sql::pUpdate($q, 'ii', $session->id, $id);
}