當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Database::sql方法代碼示例

本文整理匯總了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__);
 }
開發者ID:sendya,項目名稱:shadowsocks-panel,代碼行數:7,代碼來源:Order.php

示例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__);
 }
開發者ID:sendya,項目名稱:mcSkin,代碼行數:12,代碼來源:Skin.php

示例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__);
 }
開發者ID:sendya,項目名稱:shortUrl,代碼行數:7,代碼來源:Url.php

示例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__);
 }
開發者ID:sendya,項目名稱:shadowsocks-panel,代碼行數:7,代碼來源:Trade.php

示例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();
 }
開發者ID:sendya,項目名稱:shadowsocks-panel,代碼行數:11,代碼來源:ClearLogs.php

示例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();
     }
 }
開發者ID:sendya,項目名稱:shadowsocks-panel,代碼行數:14,代碼來源:Cron.php

示例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;
 }
開發者ID:sendya,項目名稱:shadowsocks-panel,代碼行數:15,代碼來源:Card.php

示例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;
 }
開發者ID:sendya,項目名稱:shadowsocks-panel,代碼行數:17,代碼來源:ClearTransfer.php

示例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();
         }
     }
 }
開發者ID:sendya,項目名稱:shadowsocks-panel,代碼行數:17,代碼來源:User.php

示例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__);
 }
開發者ID:sendya,項目名稱:shadowsocks-panel,代碼行數:10,代碼來源:Mail.php

示例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__);
 }
開發者ID:sendya,項目名稱:shadowsocks-panel,代碼行數:17,代碼來源:Invite.php


注:本文中的core\Database::sql方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。