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


PHP ps_DB::previousRow方法代码示例

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


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

示例1: foreach

 /**
  * This function retrieves the "neighbor" products of a product specified by $product_id
  * Neighbors are the previous and next product in the current list
  *
  * @param int $product_id
  * @return array
  */
 function get_neighbor_products($product_id)
 {
     global $perm, $orderby, $my, $auth, $keyword, $DescOrderBy, $limit, $limitstart, $search_limiter, $search_op, $category_id, $manufacturer_id, $vm_mainframe, $vmInputFilter, $product_type_id, $keyword1, $keyword2;
     $limit = 2000;
     $limitstart = 0;
     if (!empty($_SESSION['last_browse_parameters'])) {
         foreach ($_SESSION['last_browse_parameters'] as $paramName => $paramValue) {
             ${$paramName} = $paramValue;
         }
     }
     $db = new ps_DB();
     $db_browse = new ps_DB();
     if (defined('VM_ALLOW_EXTENDED_CLASSES') && defined('VM_THEMEPATH') && VM_ALLOW_EXTENDED_CLASSES && file_exists(VM_THEMEPATH . 'user_class/shop_browse_queries.php')) {
         // Load the user-defined shop_browse_queries file
         include_once VM_THEMEPATH . 'user_class/shop_browse_queries.php';
     } else {
         // Otherwise we have to use the original file
         include PAGEPATH . 'shop_browse_queries.php';
     }
     $db->query($list);
     $neighbors = array('previous' => '', 'next' => '');
     while ($db->next_record()) {
         if ($db->f('product_id') == $product_id) {
             $previous_row = $db->previousRow();
             $next_row = $db->nextRow();
             if (!empty($previous_row->product_id)) {
                 $neighbors['previous']['product_id'] = $previous_row->product_id;
                 $neighbors['previous']['product_name'] = $previous_row->product_name;
             }
             if (!empty($next_row->product_id)) {
                 $neighbors['next']['product_id'] = $next_row->product_id;
                 $neighbors['next']['product_name'] = $next_row->product_name;
             }
         }
     }
     return $neighbors;
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:44,代码来源:ps_product.php

示例2: foreach

 /**
  * This function retrieves the "neighbor" products of a product specified by $product_id
  * Neighbors are the previous and next product in the current list
  *
  * @param int $product_id
  * @return array
  */
 function get_neighbor_products($product_id)
 {
     global $perm, $orderby, $my, $auth, $keyword, $DescOrderBy, $limit, $limitstart, $search_limiter, $search_op, $category_id, $manufacturer_id, $vm_mainframe, $vmInputFilter, $product_type_id, $keyword1, $keyword2;
     $limit = 2000;
     $limitstart = 0;
     if (!empty($_SESSION['last_browse_parameters'])) {
         foreach ($_SESSION['last_browse_parameters'] as $paramName => $paramValue) {
             ${$paramName} = $paramValue;
         }
     }
     $db = new ps_DB();
     $db_browse = new ps_DB();
     include PAGEPATH . 'shop_browse_queries.php';
     $db->query($list);
     $neighbors = array('previous' => '', 'next' => '');
     while ($db->next_record()) {
         if ($db->f('product_id') == $product_id) {
             $previous_row = $db->previousRow();
             $next_row = $db->nextRow();
             if (!empty($previous_row->product_id)) {
                 $neighbors['previous']['product_id'] = $previous_row->product_id;
                 $neighbors['previous']['product_name'] = $previous_row->product_name;
             }
             if (!empty($next_row->product_id)) {
                 $neighbors['next']['product_id'] = $next_row->product_id;
                 $neighbors['next']['product_name'] = $next_row->product_name;
             }
         }
     }
     return $neighbors;
 }
开发者ID:albertobraschi,项目名称:Hab,代码行数:38,代码来源:ps_product.php


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