當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。