本文整理汇总了PHP中core\Database::sql方法的典型用法代码示例。如果您正苦于以下问题:PHP Database::sql方法的具体用法?PHP Database::sql怎么用?PHP Database::sql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core\Database
的用法示例。
在下文中一共展示了Database::sql方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getByUserId
public static function getByUserId($userid)
{
$stm = DB::sql("SELECT * FROM `orders` WHERE `uid`=? AND status = 0");
$stm->bindValue(1, $userid, DB::PARAM_INT);
$stm->execute();
return $stm->fetchAll(DB::FETCH_CLASS, __CLASS__);
}
示例2: getSkinByPlayerName
/**
* Get a skin by payer name
* @param $playerName String
* @return Skin
*/
public static function getSkinByPlayerName($playerName)
{
$stn = DB::sql("SELECT * FROM mc_skin WHERE player_name=?");
$stn->bindValue(1, $playerName, DB::PARAM_STR);
$stn->execute();
return $stn->fetchObject(__CLASS__);
}
示例3: queryUrl
public static function queryUrl($url)
{
$stm = Database::sql('SELECT `id`, `alias`, `url`, `status`, `add_time`, `click_num` FROM `url_list` WHERE `url`=?');
$stm->bindValue(1, $url, Database::PARAM_STR);
$stm->execute();
return $stm->fetchObject(__CLASS__);
}
示例4: getByTrade
public static function getByTrade($trade)
{
$stm = DB::sql('SELECT id, trade, has_notify FROM trade WHERE trade=?');
$stm->bindValue(1, $trade);
$stm->execute();
return $stm->fetchObject(__CLASS__);
}
示例5: run
public function run()
{
// 清理一个月前的数据
$mon = time() - 2592000;
$stn = Database::sql('DELETE FROM `card` WHERE add_time<? AND status=0');
$stn->bindValue(1, $mon, Database::PARAM_INT);
$stn->execute();
$stn = Database::sql("DELETE FROM `invite` WHERE dateLine<? AND status=1");
$stn->bindValue(1, $mon, Database::PARAM_INT);
$stn->execute();
}
示例6: setNextRun
public static function setNextRun($cronId, $step)
{
$inTransaction = DB::getInstance()->inTransaction();
if (!$inTransaction) {
DB::getInstance()->beginTransaction();
}
$st = DB::sql("UPDATE cron SET nextrun=? WHERE id=?");
$st->bindValue(1, $step, DB::PARAM_INT);
$st->bindValue(2, $cronId, DB::PARAM_STR);
$st->execute();
if (!$inTransaction) {
DB::getInstance()->commit();
}
}
示例7: destroy
public function destroy()
{
$inTransaction = DB::getInstance()->inTransaction();
if (!$inTransaction) {
DB::getInstance()->beginTransaction();
}
$st = DB::sql("UPDATE card SET status=0 WHERE card=:card");
// 失效卡
$st->bindValue(":card", $this->card, DB::PARAM_STR);
$flag = $st->execute();
if (!$inTransaction) {
DB::getInstance()->commit();
}
return $flag;
}
示例8: run
public function run()
{
$resetDate = '1';
$date = date("d", time());
if ($date == $resetDate) {
$inTransaction = DB::getInstance()->inTransaction();
if (!$inTransaction) {
DB::getInstance()->beginTransaction();
}
$st = DB::sql("UPDATE member SET flow_up=0, flow_down=0 WHERE `enable`=1 AND `plan`!='Z'");
$st->execute();
if (!$inTransaction) {
DB::getInstance()->commit();
}
}
return false;
}
示例9: setAdmin
/**
* Set administrator
*/
public function setAdmin($val)
{
if ($val == 1 && !$this->isAdmin()) {
$stn = DB::sql("INSERT INTO `admin` SET uid=?");
$stn->bindValue(1, $this->uid, DB::PARAM_INT);
$stn->execute();
} else {
if ($val == 0 && $this->isAdmin()) {
$stn = DB::sql("DELETE FROM `admin` WHERE uid=?");
$stn->bindValue(1, $this->uid, DB::PARAM_INT);
$stn->execute();
}
}
}
示例10: getQueueList
/**
* Get mail queue list on limit 2
* @return Mail
*/
public static function getQueueList()
{
$st = DB::sql("SELECT `id`,`to`,`subject`,`content` FROM mail_queue LIMIT 2");
$st->execute();
return $st->fetchAll(DB::FETCH_CLASS, __CLASS__);
}
示例11: getInvitesByUid
/**
* Get invites by uid
* @param int $uid
* @param string $status
* @return array
*/
public static function getInvitesByUid($uid = -1, $status = "")
{
$sql = "SELECT * FROM invite WHERE uid={$uid} ";
if ($status != "") {
$sql .= "AND status={$status} ";
}
$sql .= "ORDER BY dateLine DESC";
$stn = DB::sql($sql);
$stn->execute();
return $stn->fetchAll(DB::FETCH_CLASS, __CLASS__);
}