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


PHP DB::numRows方法代码示例

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


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

示例1: getNewGoods

 static function getNewGoods($count)
 {
     $res = DB::query('SELECT
       DISTINCT p.id,
       CONCAT(c.parent_url,c.url) as category_url,
       p.url as product_url,
       p.*, pv.product_id as variant_exist
     FROM `' . PREFIX . 'product` p
     LEFT JOIN `' . PREFIX . 'category` c
       ON c.id = p.cat_id
     LEFT JOIN `' . PREFIX . 'product_variant` pv
       ON p.id = pv.product_id
     LEFT JOIN (
       SELECT pv.product_id, SUM( pv.count ) AS varcount
       FROM  `' . PREFIX . 'product_variant` AS pv
       GROUP BY pv.product_id
     ) AS temp ON p.id = temp.product_id WHERE new = 1 LIMIT ' . $count . '');
     if (DB::numRows($res) != 0) {
         while ($row = DB::fetchAssoc($res)) {
             if ($row['image_url']) {
                 $img = explode('|', $row['image_url']);
                 $row['image_url'] = $img[0];
             }
             $array[] = $row;
         }
         return $array;
     }
 }
开发者ID:WinGood,项目名称:24karcher,代码行数:28,代码来源:index.php

示例2: getProduct

 static function getProduct($count)
 {
     $res = DB::query('SELECT
       DISTINCT p.id,
       CONCAT(c.parent_url,c.url) as category_url,
       p.url as product_url,
       p.*, v.views, pv.product_id as variant_exist
     FROM `' . PREFIX . self::$pluginName . '_visits` v
     INNER JOIN `' . PREFIX . 'product` p ON v.id_product = p.id
     LEFT JOIN `' . PREFIX . 'category` c
       ON c.id = p.cat_id
     LEFT JOIN `' . PREFIX . 'product_variant` pv
       ON p.id = pv.product_id
     LEFT JOIN (
       SELECT pv.product_id, SUM( pv.count ) AS varcount
       FROM  `' . PREFIX . 'product_variant` AS pv
       GROUP BY pv.product_id
     ) AS temp ON p.id = temp.product_id ORDER BY v.views DESC LIMIT ' . $count . '');
     if (DB::numRows($res) != 0) {
         while ($row = DB::fetchAssoc($res)) {
             if ($row['image_url']) {
                 $img = explode('|', $row['image_url']);
                 $row['image_url'] = $img[0];
             }
             $array[] = $row;
         }
         return $array;
     }
 }
开发者ID:WinGood,项目名称:24karcher,代码行数:29,代码来源:index.php

示例3: DB

 /**
  *  Gather all the info on the selected user id
  * @param string $id 
  */
 function __construct($id)
 {
     $this->id = $id;
     $db = new DB("users");
     $db->setColPrefix("user_");
     $db->select("user_id = '{$id}'");
     if ($db->numRows()) {
         $db->nextRecord();
         foreach ($db->record as $name => $value) {
             if ($value == "0") {
                 $value = false;
             } else {
                 if ($value == "1") {
                     $value = true;
                 }
             }
             $this->__set($name, $value);
         }
         $db = new DB("groups");
         $db->setColPrefix("group_");
         $db->select("group_id = '" . $this->_user['group'] . "'");
         $db->nextRecord();
         $this->__set("group_name", $db->name);
         $this->__set("group_access", $db->acl);
     } else {
         $this->__set("id", "0");
         $this->__set("group_access", "");
         $this->__set("name", "Unknown");
         $this->__set("avatar", "");
     }
 }
开发者ID:thefkboss,项目名称:openTracker,代码行数:35,代码来源:Acl.php

示例4: isInstalled

 /**
  *  Check if the selected addon is installed.
  * @return boolean 
  */
 function isInstalled()
 {
     $db = new DB("addons");
     $db->select("addon_name = '" . $db->escape($this->_name) . "' and addon_installed = '1'");
     if ($db->numRows()) {
         return true;
     }
 }
开发者ID:thefkboss,项目名称:openTracker,代码行数:12,代码来源:Addon.php

示例5: getOption

 static function getOption($name)
 {
     $res = DB::query("\n\t\t\tSELECT value FROM `" . PREFIX . self::$pluginName . "` WHERE `option` = '{$name}'\n\t\t");
     if (DB::numRows($res) != 0) {
         while ($row = DB::fetchAssoc($res)) {
             $array[] = $row;
         }
         return $array[0]['value'];
     }
 }
开发者ID:WinGood,项目名称:24karcher,代码行数:10,代码来源:index.php

示例6: isInstalled

function isInstalled()
{
    $db = new DB($GLOBALS['db_name'], $GLOBALS['mysql_server'], $GLOBALS['db_user'], $GLOBALS['db_pw']);
    $result = $db->query("SELECT user_id FROM grammafone_users");
    if ($db->numRows($result) > 0) {
        return true;
    } else {
        return false;
    }
}
开发者ID:benbruscella,项目名称:Gramophone,代码行数:10,代码来源:grammafone.php

示例7: getLastPost

/**
 * Return the last post
 * @param int $id
 * @return array 
 */
function getLastPost($id)
{
    $db = new DB("forum_posts");
    $db->select("post_id = '" . $id . "'");
    if (!$db->numRows()) {
        return false;
    }
    $db->nextRecord();
    return $db->record;
}
开发者ID:thefkboss,项目名称:openTracker,代码行数:15,代码来源:main.php

示例8: getEntity

 static function getEntity()
 {
     $res = DB::query("\n\t\t\tSELECT * FROM `" . PREFIX . self::$pluginName . "` WHERE invisible = 1 ORDER BY `sort` ASC\n\t\t");
     if (DB::numRows($res) != 0) {
         while ($row = DB::fetchAssoc($res)) {
             $array[] = $row;
         }
         return $array;
     }
 }
开发者ID:WinGood,项目名称:24karcher,代码行数:10,代码来源:index.php

示例9: createDateBase

 /**
  * Создает таблицу плагина в БД
  */
 static function createDateBase()
 {
     DB::query("\r\n     CREATE TABLE IF NOT EXISTS `" . PREFIX . self::$pluginName . "` (\r\n      `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Порядковый номер записи',\r\n      `type` varchar(255) NOT NULL COMMENT 'Тип слайда картинка или HTML',\r\n\t    `nameaction` text NOT NULL COMMENT 'Название слайда',\r\n      `href` text NOT NULL COMMENT 'ссылка', \r\n      `value` text NOT NULL COMMENT 'значение',      \r\n      `sort` int(11) NOT NULL COMMENT 'Порядок слайдов',\r\n      `invisible` int(1) NOT NULL COMMENT 'видимость',\r\n      PRIMARY KEY (`id`)\r\n    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
     // запрос для проверки, был ли плагин установлен ранее.
     $res = DB::query("\r\n      SELECT id\r\n      FROM `" . PREFIX . self::$pluginName . "`\r\n      WHERE id in (1,2,3) \r\n    ");
     // если плагин впервые активирован то задаются настройки по умолчанию
     if (!DB::numRows($res)) {
         DB::query("\r\n      INSERT INTO `" . PREFIX . self::$pluginName . "` (`id`, `type`,`nameaction`, `href`, `value`, `sort`, `invisible`) VALUES\r\n        (1, 'img', 'Акция 1','" . SITE . "/catalog', " . DB::quote("<img src='" . SITE . '/mg-plugins/' . self::$pluginName . "/images/pic/slide1.jpg' alt=''>") . ", 1,1),\r\n        (2, 'img', 'Акция 2','" . SITE . "/feedback', " . DB::quote("<img src='" . SITE . '/mg-plugins/' . self::$pluginName . "/images/pic/slide2.jpg' alt=''>") . ", 2,1),\r\n        (3, 'html', 'Акция 3','" . SITE . "/contacts', '<div style=\"background-color: blue; width: 1000px; height: 300px; text-align: center; background:rgb(214, 214, 214);\"><br />\n<span style=\"color:#006400;\"><span style=\"font-size:24px;\"><strong><font face=\"georgia, serif\">Название акциии<br />\n<br />\n<br />\n<br />\n<br />\nЛюбой HTML контент</font></strong></span></span><br />\n<br />\n<br />\n&nbsp;</div>\n', 3,1);\r\n      ");
         $array = array('width' => '', 'height' => '', 'speed' => '2000', 'pause' => '1500', 'mode' => 'horizontal', 'position' => 'left');
         MG::setOption(array('option' => 'sliderActionOption', 'value' => addslashes(serialize($array))));
     }
 }
开发者ID:kostiukoleg,项目名称:all4web.loc,代码行数:15,代码来源:index.php

示例10: login

 /**
  * Carrega os dados de um determinado pelo $id.
  * Caso exista carrega os dados em
  * $_SESSION['ll']['user'] e $_ll['user'],
  * retornando <b>TRUE</b>;
  * Retorna uma Exception se o usuario não existe.
  * 
  * @param integer|string $id
  * @return boolean 
  */
 public function login($id)
 {
     global $_ll;
     $id = parent::antiInjection($id);
     $q = parent::select('SELECT id, login, nome, email, foto, grupo, themer FROM ' . $this . ' WHERE id="' . $id . '"');
     if (parent::numRows($q) == 0) {
         throw new Exception('Usuario não existe', 0);
     }
     $_SESSION['ll']['user'] = $q[0];
     $_ll['user'] =& $_SESSION['ll']['user'];
     return TRUE;
 }
开发者ID:jomadee,项目名称:bordercollie,代码行数:22,代码来源:su.php

示例11: load

 /**
  * Load notifications
  * @param type $limit 
  */
 function load($limit = 5)
 {
     $db = new DB("notifications");
     $db->setColPrefix("notification_");
     $db->setSort("notification_added DESC");
     if (intval($limit)) {
         $db->setLimit($limit);
     }
     $db->select("notification_user = '" . USER_ID . "'");
     if ($db->numRows()) {
         $return = "";
         while ($db->nextRecord()) {
             $return .= "<li>";
             switch ($db->type) {
                 case 'friend':
                     $data = json_decode($db->data);
                     $user = new Acl($data->user);
                     switch ($data->type) {
                         case 'accept':
                             $return .= "<b><a href='" . page("profile", "view", $user->name) . "'>" . $user->name . "</a></b> <small>" . get_date($db->added) . "</small> <br /> " . _t("Has accepted your friend request");
                             break;
                         case 'decline':
                             $return .= "<b><a href='" . page("profile", "view", $user->name) . "'>" . $user->name . "</a></b> <small>" . get_date($db->added) . "</small> <br /> " . _t("Has declined your friend request");
                             break;
                         case 'remove':
                             $return .= "<b><a href='" . page("profile", "view", $user->name) . "'>" . $user->name . "</a></b> <small>" . get_date($db->added) . "</small> <br /> " . _t("Has removed you from his friends list");
                             break;
                     }
                     break;
                 case 'system':
                     $data = json_decode($db->data);
                     $group = new DB("groups");
                     $group->setColPrefix("group_");
                     $group->select("group_id = '" . $data->group . "'");
                     $group->nextRecord();
                     switch ($data->type) {
                         case 'upgrade':
                             $return .= _t("You have been upgraded to ") . "<b>" . $group->name . "</b><br /><small>" . get_date($db->added) . "</small>";
                             break;
                         case 'downgrade':
                             $return .= _t("You have been demoted to ") . "<b>" . $group->name . "</b><br /><small>" . get_date($db->added) . "</small>";
                             break;
                     }
                     break;
             }
             $return .= "</li>";
         }
     } else {
         $return = "<li>" . _t("No notifications found") . "</li>";
     }
     echo $return;
 }
开发者ID:thefkboss,项目名称:openTracker,代码行数:56,代码来源:main.php

示例12: get_links

function get_links()
{
    include_once "db.inc.php";
    $db = new DB();
    $db->open();
    $query = "SELECT * FROM links ORDER BY order_";
    $result = $db->query($query);
    $num_results = $db->numRows($result);
    for ($i = 0; $i < $num_results; $i++) {
        $row = $db->fetchArray($result);
        $txttitle = str_replace("_", " ", $row[title]);
        echo '<li><a href="' . $row[url] . '">' . $txttitle . '</a></li>';
    }
}
开发者ID:kbrooker99206,项目名称:jewelleesherbals,代码行数:14,代码来源:index.php

示例13: getImgCat

 static function getImgCat($id)
 {
     if (!empty($id)) {
         $res = DB::query("SELECT * FROM `" . PREFIX . self::$pluginName . "` WHERE `id_cat`=" . $id);
         if (DB::numRows($res) > 0) {
             $arr = DB::fetchAssoc($res);
             if (!empty($arr['img'])) {
                 return PLUGIN_DIR . self::$pluginName . '/img/' . $arr['img'];
             }
         }
     } else {
         echo 'Не указан обязательный атрибут id';
     }
 }
开发者ID:WinGood,项目名称:24karcher,代码行数:14,代码来源:index.php

示例14: createTable

 static function createTable()
 {
     DB::query("\n\t     CREATE TABLE IF NOT EXISTS `" . PREFIX . "call_back` (\n\t      `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Порядковый номер записи',\n\t\t  `name` text NOT NULL COMMENT 'Имя',\n\t      `phone` text NOT NULL COMMENT 'Телефон',      \n\t      `time` timestamp DEFAULT NOW() COMMENT 'Время добавления заявки',\n\t      `invisible` int(1) NOT NULL COMMENT 'Просмотр заявки',\n\t      `comment` text NULL COMMENT 'Комментарий к заявке',\n\t      PRIMARY KEY (`id`)\n\t    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
     DB::query("\n\t    \tCREATE TABLE IF NOT EXISTS `" . PREFIX . "call_back_config` (\n\t    \t`id` int(11) NOT NULL AUTO_INCREMENT ,\n\t    \t`send_mail` ENUM('0','1') DEFAULT '0',\n\t    \t`email_address` VARCHAR(200) NOT NULL DEFAULT '" . MG::getOption('adminEmail') . "',\n\t    \tPRIMARY KEY (`id`)\n\t    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;");
     $seeds = DB::query("SELECT * FROM `" . PREFIX . 'call_back_config' . "`");
     $numb = DB::numRows($seeds);
     if ($numb == 0) {
         DB::query("\n\t    \t\tINSERT INTO `" . PREFIX . 'call_back_config' . "` VALUES(NULL, '0', '" . MG::getOption('adminEmail') . "')\n\t    \t");
     }
     // Был ли плагин активирован ранее?
     $res = DB::query("\n\t    \tSELECT id\n\t    \tFROM `" . PREFIX . "call_back`\n\t    \tWHERE id in (1,2,3)\n\t    ");
     // Если плагин впервые активирован, то задаются настройки по умолчанию
     if (!DB::numRows($res)) {
         $array = array('countRows' => '10');
         MG::setOption(array('option' => 'call-backOption', 'value' => addslashes(serialize($array))));
     }
 }
开发者ID:WinGood,项目名称:24karcher,代码行数:17,代码来源:index.php

示例15: update

 /**
  * Update the pref values on the selected target. 
  */
 function update()
 {
     $db = new DB("pref");
     $db->setColPrefix("pref_");
     foreach ($this->_vars as $name => $value) {
         $db->select("pref_name = '" . $name . "' AND pref_target = '" . $db->escape($this->target) . "'");
         if ($db->numRows()) {
             $db->value = $value;
             $db->update("pref_name = '" . $name . "' AND pref_target = '" . $db->escape($this->target) . "'");
         } else {
             $db->name = $name;
             $db->value = $value;
             $db->target = $this->target;
             $db->insert();
         }
     }
 }
开发者ID:thefkboss,项目名称:openTracker,代码行数:20,代码来源:Pref.php


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