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