本文整理汇总了PHP中SC_Query::setlimit方法的典型用法代码示例。如果您正苦于以下问题:PHP SC_Query::setlimit方法的具体用法?PHP SC_Query::setlimit怎么用?PHP SC_Query::setlimit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SC_Query
的用法示例。
在下文中一共展示了SC_Query::setlimit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRanking
function getRanking()
{
$objQuery = new SC_Query();
$col = "T1.product_id, T1.product_name as name,COUNT(*) AS order_count ";
$from = "dtb_order_detail AS T1\r\n INNER JOIN dtb_order AS T2 ON T1.order_id = T2.order_id\r\n INNER JOIN dtb_products AS T3 ON T1.product_id = T3.product_id";
$objQuery->setgroupby("T1.product_id,T1.product_name");
$objQuery->setorder("order_count DESC");
$objQuery->setlimit(10);
//var_dump($objQuery->setorder("order_count DESC"));
return $objQuery->select($col, $from, 'T2.status = ?', array('5'));
}
示例2: lfGetRelateProducts
function lfGetRelateProducts($tmp_id)
{
$objQuery = new SC_Query();
//自動抽出
$objQuery->setorder("random()");
//表示件数の制限
$objQuery->setlimit(RELATED_PRODUCTS_MAX);
//検索条件
$col = "name, main_list_image, price01_min, price02_min, price01_max, price02_max, point_rate";
$from = "vw_products_allclass AS allcls ";
$where = "del_flg = 0 AND status = 1 AND (stock_max <> 0 OR stock_max IS NULL) AND product_id = ? ";
$arrval[] = $tmp_id;
//結果の取得
$arrProducts = $objQuery->select($col, $from, $where, $arrval);
return $arrProducts;
}
示例3: lfGetRecommendProducts
/**
* デストラクタ.
*
* @return void
*/
function lfGetRecommendProducts($product_id)
{
$objQuery = new SC_Query();
$cols = '*, (SELECT COUNT(*) FROM dtb_order_detail WHERE product_id = alldtl.product_id) AS cnt';
$from = 'vw_products_allclass_detail AS alldtl';
$where = <<<__EOS__
del_flg = 0
AND status = 1
AND product_id IN (
SELECT product_id
FROM
dtb_order_detail
INNER JOIN dtb_order
ON dtb_order_detail.order_id = dtb_order.order_id
WHERE 0=0
AND dtb_order.del_flg = 0
AND dtb_order.order_id IN (
SELECT order_id
FROM dtb_order_detail
WHERE 0=0
AND product_id = ?
)
AND dtb_order_detail.product_id <> ?
)
__EOS__;
$objQuery->setorder('cnt DESC, RANDOM()');
$objQuery->setlimit($this->max);
$recommendProducts = $objQuery->select($cols, $from, $where, array($product_id, $product_id));
return $recommendProducts;
}