本文整理汇总了PHP中Db::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP Db::execute方法的具体用法?PHP Db::execute怎么用?PHP Db::execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Db
的用法示例。
在下文中一共展示了Db::execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set
/**
* @param string $key
*/
public function set($guildID, $key, $value)
{
$json = $this->getAll($guildID);
$json->{$key} = $value;
$data = json_encode($json);
$this->db->execute("INSERT INTO settings (serverID, settings) VALUES (:serverID, :settings) ON DUPLICATE KEY UPDATE settings = :settings", array(":serverID" => $guildID, ":settings" => $data));
}
示例2: synchronize
/**
* @return Model
*/
public function synchronize()
{
$tables = $this->db->tables();
if (false === array_search($this->table, $tables)) {
$properties = array();
foreach ($this->properties as $name => $instance) {
if (is_subclass_of($instance, 'Property')) {
$properties[] = "`{$name}` " . $instance->__toString();
}
}
$this->db->execute("CREATE TABLE `{$this->table}` (" . implode(', ', $properties) . ")");
}
return $this;
}
示例3: updatePassword
public static function updatePassword($password)
{
$userID = user::getUserID();
$password = self::genPassword($password);
Db::execute("UPDATE zz_users SET password = :password WHERE id = :userID", array(":password" => $password, ":userID" => $userID));
return "Updated password";
}
示例4: process
public function process()
{
$db = new Db();
$perishable_token = $this->generateToken();
$query = "insert into user (email, password, perishable_token, last_activity_timestamp, signup_timestamp) values (" . "'" . $this->attributes['email'] . "', " . "'" . $this->attributes['password'] . "', " . "'" . $perishable_token . "', " . time() . ", " . time() . ")";
return $db->execute($query);
}
示例5: UpdateRouteAssignment
function UpdateRouteAssignment()
{
$arrRouteAssignment = array('varRouteId' => $_POST['txtRouteId'], 'varRouteAssignment' => $_POST['txtRouteAssignment']);
Db::execute('UPDATE routes SET assignment = :varRouteAssignment WHERE rtcode = :varRouteId', $arrRouteAssignment);
$varResult = Db::getRow('SELECT * FROM routes WHERE rtcode = ?', $arrRouteAssignment['varRouteId']);
echo 'Update Completed. Route assigned to ' . $varResult['assignment'];
}
示例6: updatePoints
public static function updatePoints($killID, $tempTables = false)
{
$points = self::calculatePoints($killID, $tempTables);
$temp = $tempTables ? "_temporary" : "";
Db::execute("update zz_participants{$temp} set points = :points where killID = :killID", array(":points" => $points, ":killID" => $killID));
return $points;
}
示例7: postProfile
/**
* @url POST profile/{userId}
* @url PUT {userId}
*/
protected function postProfile($userId, $firstname, $lastname, $nickname, $phone, $birthdate, $school, $province, $level, $purpose, $avatarId)
{
if ($userId == \TTO::getUserId()) {
$statement = '
UPDATE user SET
firstname = :firstname,
lastname = :lastname,
nickname = :nickname,
phone = :phone,
birthdate = :birthdate,
school = :school,
province = :province,
level = :level,
purpose = :purpose,
avatarId = :avatarId
WHERE userId = :userId
';
$bind = array('firstname' => $firstname, 'lastname' => $lastname, 'nickname' => $nickname, 'phone' => $phone, 'birthdate' => $birthdate, 'school' => $school, 'province' => $province, 'level' => $level, 'purpose' => $purpose, 'avatarId' => $avatarId, 'userId' => $userId);
$row_update = \Db::execute($statement, $bind);
\TTOMail::createAndSendAdmin('A user updated profile', json_encode($bind));
$response = new \stdClass();
$response->row_update = $row_update;
return $response;
} else {
throw new RestException(401, 'No Authorize or Invalid request !!!');
}
}
示例8: irc_log
function irc_log($nick, $uhost, $command, $params)
{
$id = Db::queryField("SELECT id FROM zz_irc_access WHERE name = :nick AND host = :uhost", "id", array(":nick" => $nick, ":uhost" => $uhost));
if ($id == null) {
$id = 0;
}
Db::execute("INSERT INTO zz_irc_log (id, nick, command, parameters) VALUES (:id, :nick, :command, :params)", array(":nick" => $nick, ":id" => $id, ":command" => $command, ":params" => implode(" ", $params)));
}
示例9: cachePrimer
public static function cachePrimer()
{
Db::execute("set session wait_timeout = 120");
self::storeResult(Db::query("select c.* from zz_characters c left join zz_participants p on (c.characterID = p.characterID) where dttm > date_sub(now(), interval 5 day) group by characterID", array(), 0), "select name from zz_characters where characterID = :id", ":id", "characterID", "name");
self::storeResult(Db::query("select * from zz_corporations", array(), 0), "select name from zz_corporations where corporationID = :id", ":id", "corporationID", "name");
self::storeResult(Db::query("select * from zz_alliances", array(), 0), "select name from zz_alliances where allianceID = :id", ":id", "allianceID", "name");
self::storeResult(Db::query("select * from ccp_invTypes", array(), 0), "select typeName from invTypes where typeID = :typeID", ":typeID", "typeID", "typeName");
}
示例10: runSql
/**
* @param string $sql
* @param array $params
* @return bool|ResultSet
*/
protected function runSql($sql, $params = array())
{
$rez = $this->db->execute($sql, $params);
if (!$rez) {
$this->logError($this->db->lastError);
}
return $rez;
}
示例11: handle
/**
* 定单处理
* @param $tid 定单编号
*/
public function handle($tid)
{
Db::table('balance')->where('tid', $tid)->update(array('status' => 1));
//添加会员余额
$balance = Db::table('balance')->where('siteid', SITEID)->where('tid', $tid)->first();
$sql = "UPDATE " . tablename('member') . " SET credit2=credit2+{$balance['fee']} WHERE uid={$balance['uid']}";
Db::execute($sql);
}
示例12: delete
/**
* 删除数据
*
* @param string $table
* @param string $where
*/
public function delete($where = null, $table = '')
{
if (empty($table)) {
$table = $this->table;
}
$sql = 'DELETE FROM ' . $table . (is_null($where) ? '' : ' WHERE ' . (is_array($where) ? implode(' AND ', $where) : $where));
return $this->db->execute($sql);
}
示例13: consumeNonce
function consumeNonce($form)
{
$now = time();
if (!isset($form['nonce']) || $form['nonce'] != $_SESSION['hg_nonce'] || !preg_match('/^\\d\\d\\d\\d-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\dZ/', $form['nonce'], $ma) || !($timestamp = strtotime($ma[0])) || $timestamp > $now || $timestamp < $now - 60 * 60 || Db::scalarQuery('SELECT stamp FROM jos_oauthp_nonces WHERE nonce = ?', array($form['nonce']))) {
//throw new Exception('Bad token', 405);
}
Db::execute('UPDATE jos_oauthp_nonces SET stamp = 1 WHERE nonce = ?', array($form['nonce']));
unset($_SESSION['hg_nonce']);
}
示例14: save
public function save()
{
$params = json_encode($this->settings);
$updateQuery = 'UPDATE jos_extensions SET params = ? WHERE `type`=\'component\' AND `element` = \'com_hubgraph\'';
$insertQuery = 'INSERT INTO jos_extensions(name, `type`, `element`, params) VALUES (\'HubGraph\', \'component\', \'com_hubgraph\', ?)';
if (!Db::update($updateQuery, array($params))) {
Db::execute($insertQuery, array($params));
}
}
示例15: updateJEditableField
function updateJEditableField($table, $field, $value, $id)
{
$data = array('id' => $id, 'value' => $value);
try {
Db::execute("UPDATE {$table} SET {$field} = :value WHERE id = :id", $data);
echo nl2br($value);
} catch (Exception $e) {
echo 'Error occured';
}
}