当前位置: 首页>>代码示例>>PHP>>正文


PHP Select::from方法代码示例

本文整理汇总了PHP中Select::from方法的典型用法代码示例。如果您正苦于以下问题:PHP Select::from方法的具体用法?PHP Select::from怎么用?PHP Select::from使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Select的用法示例。


在下文中一共展示了Select::from方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAllOnID

 protected static function getAllOnID($table, $id)
 {
     $select = new Select(self::$db);
     $select->from($table, "*")->where("`id` = ?", array($id));
     $data = self::$db->select($select);
     return $data;
 }
开发者ID:kuaa59,项目名称:www,代码行数:7,代码来源:objectdb_class.php

示例2: loadRandom

 public function loadRandom()
 {
     $select = new Select(self::$db);
     $select->from(self::$table, "*")->where("`state` =" . self::$db->getSQ(), array(1))->rand()->limit(1);
     $row = self::$db->selectRow($select);
     return $this->init($row);
 }
开发者ID:trukfit,项目名称:htdocs,代码行数:7,代码来源:polldb_class.php

示例3: loadRandom

 public function loadRandom()
 {
     $select = new Select(self::$db);
     $select->from(self::$table, "*")->rand()->limit(1);
     $row = self::$db->selectRow($select);
     return $this->init($row);
 }
开发者ID:itservicedv,项目名称:engine_rusakov_source,代码行数:7,代码来源:quotedb_class.php

示例4: getImgOnID

 public static function getImgOnID($id)
 {
     $select = new Select(self::$db);
     $select->from(self::$table, "*")->where("`product_id` = " . self::$db->getSQ(), array($id));
     $data = self::$db->select($select);
     $images = ObjectDB::buildMultiple(__CLASS__, $data);
     return $images;
 }
开发者ID:kuaa59,项目名称:www,代码行数:8,代码来源:imgdb_class.php

示例5: getStudentsOnGroupID

 public static function getStudentsOnGroupID($group_id)
 {
     $select = new Select(self::$db);
     $select->from(self::$table, "*")->where("`group_id` = ?", array($group_id));
     $data = self::$db->select($select);
     $students = ObjectDB::buildMultiple(__CLASS__, $data);
     //foreach ($groups as $g) $g->postHandling();
     return $students;
 }
开发者ID:kuaa59,项目名称:www,代码行数:9,代码来源:studentdb_class.php

示例6: getItems

 public static function getItems()
 {
     $select = new Select(self::$db);
     $select->from(self::$table, array("s.*", "p.img"), "s")->join("INNER", "product", "p", "s.product_id = p.id");
     $data = self::$db->select($select);
     $slider = ObjectDB::buildMultiple(__CLASS__, $data);
     foreach ($slider as $slide) {
         $slide->postHandling();
     }
     return $slider;
 }
开发者ID:kuaa59,项目名称:www,代码行数:11,代码来源:sliderdb_class.php

示例7: getItemsOnView

 public static function getItemsOnView($view)
 {
     $select = new Select(self::$db);
     $select->from(self::$table, "*")->where("`view_id` = ?", array($view));
     $data = self::$db->select($select);
     $items = ObjectDB::buildMultiple(__CLASS__, $data);
     foreach ($items as $item) {
         $item->postHandling();
     }
     return $items;
 }
开发者ID:kuaa59,项目名称:www,代码行数:11,代码来源:gallerydb_class.php

示例8: getGroupsOnTeacherID

 public static function getGroupsOnTeacherID($id)
 {
     $select = new Select(self::$db);
     $select->from(self::$table, "*")->where("`teacher_id` = ?", array($id));
     $data = self::$db->select($select);
     $groups = ObjectDB::buildMultiple(__CLASS__, $data);
     foreach ($groups as $g) {
         $g->postHandling();
     }
     return $groups;
 }
开发者ID:kuaa59,项目名称:www,代码行数:11,代码来源:groupdb_class.php

示例9: getIdonNumder

 public static function getIdonNumder($number)
 {
     $select = new Select(self::$db);
     $select->from(self::$table, array("id"))->where("`number` = ?", array($number));
     $id = self::$db->selectCell($select);
     if (!$id) {
         $select = new Select(self::$db);
         $select->from(self::$table, array("id"))->where("`parent_number` = ?", array($number));
         $id = self::$db->selectCell($select);
     }
     return $id;
 }
开发者ID:kuaa59,项目名称:www,代码行数:12,代码来源:categorydb_class.php

示例10: loadOnSectionID

 public function loadOnSectionID($section_id, $type)
 {
     $select = new Select();
     $select->from(self::$table, "*")->where("`type` = " . self::$db->getSQ(), array($type))->where("`latest` = " . self::$db->getSQ(), array(1))->rand();
     $data_1 = self::$db->select($select);
     $select = new Select();
     $select->from(self::$table, "*")->where("`type` = " . self::$db->getSQ(), array($type));
     if ($section_id) {
         $select->whereFIS("section_ids", $section_id);
     }
     $select->rand();
     $data_2 = self::$db->select($select);
     $data = array_merge($data_1, $data_2);
     if (count($data) == 0) {
         $select = new Select();
         $select->from(self::$table, "*")->where("`type` = " . self::$db->getSQ(), array($type))->rand();
         $data = self::$db->select($select);
     }
     $data = ObjectDB::buildMultiple(__CLASS__, $data);
     uasort($data, array(__CLASS__, "compare"));
     $first = array_shift($data);
     $this->load($first->id);
 }
开发者ID:andreiBall,项目名称:main-site,代码行数:23,代码来源:coursedb_class.php

示例11: authAdmin

 public static function authAdmin($login = false, $password = false)
 {
     if ($login) {
         $auth = true;
     } else {
         if (!session_id()) {
             session_start();
         }
         if (!empty($_SESSION["auth_login"]) && !empty($_SESSION["auth_password"])) {
             $login = $_SESSION["auth_login"];
             $password = $_SESSION["auth_password"];
         } else {
             return;
         }
         $auth = false;
     }
     $user = new AdminDB();
     if ($auth) {
         $password = self::hash($password, Config::SECRET);
     }
     $select = new Select();
     $select->from(self::$table, array("COUNT(id)"))->where("`login` = " . self::$db->getSQ(), array($login))->where("`password` = " . self::$db->getSQ(), array($password));
     $count = self::$db->selectCell($select);
     if ($count) {
         $user->loadOnLogin($login);
         if ($user->activation != "") {
             throw new Exception("ERROR_ACTIVATE_USER");
         }
         if ($auth) {
             $user->login();
         }
         return $user;
     }
     if ($auth) {
         throw new Exception("ERROR_AUTH_USER");
     }
 }
开发者ID:kuaa59,项目名称:www,代码行数:37,代码来源:admindb_class.php

示例12: isAlreadyPoll

 public static function isAlreadyPoll($poll_data_ids)
 {
     $select = new Select(self::$db);
     $select->from(self::$table, array("id"))->whereIn("poll_data_id", $poll_data_ids)->where("`ip` = " . self::$db->getSQ(), array(ip2long($_SERVER["REMOTE_ADDR"])))->limit(1);
     return self::$db->selectCell($select) ? true : false;
 }
开发者ID:itservicedv,项目名称:engine_rusakov_source,代码行数:6,代码来源:pollvoterdb_class.php

示例13: getCountOnArticleID

 public static function getCountOnArticleID($article_id)
 {
     $select = new Select(self::$db);
     $select->from(self::$table, array("COUNT(id)"))->where("`article_id` = " . self::$db->getSQ(), array($article_id));
     return self::$db->selectCell($select);
 }
开发者ID:itservicedv,项目名称:engine_rusakov_source,代码行数:6,代码来源:commentdb_class.php

示例14: fetchAll

        }
        if (!empty($this->_select['where'])) {
            $sql .= ' WHERE ' . $this->_select['where'];
        }
        if (count($this->_select['and'])) {
            $sql .= ' AND ' . join(' AND ', $this->_select['and']);
        }
        if (count($this->_select['or'])) {
            $sql .= ' OR ' . join(' OR ', $this->_select['and']);
        }
        if (!empty($this->_select['limit'])) {
            $sql .= ' LIMIT ' . $this->_select['limit'];
        }
        return $sql;
    }
    public function fetchAll()
    {
        $sql = $this->_buildSQL();
        echo $sql, '<br/><br/>';
    }
    function fetchOne()
    {
        print_r($this->_select);
        $this->_select['limit'] = '0,1';
        $sql = $this->_buildSQL();
        echo $sql, '<br/><br/>';
    }
}
$s1 = new Select();
$s1->from('aa')->fields('a,b')->fetchAll();
$s1->from('aa')->fields('a,b')->fetchOne();
开发者ID:denson7,项目名称:phpstudy,代码行数:31,代码来源:test.php

示例15: issetAliasOnLink

 public static function issetAliasOnLink($link)
 {
     $select = new Select(self::$db);
     $select->from(self::$table, "*")->where("`category_id` = ?", array($link));
     $data = self::$db->select($select);
 }
开发者ID:kuaa59,项目名称:www,代码行数:6,代码来源:sefdb_class.php


注:本文中的Select::from方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。