本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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");
}
}
示例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;
}
示例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);
}
示例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();
示例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);
}