当前位置: 首页>>代码示例>>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;未经允许,请勿转载。