本文整理汇总了PHP中mysql::recordPage方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql::recordPage方法的具体用法?PHP mysql::recordPage怎么用?PHP mysql::recordPage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql
的用法示例。
在下文中一共展示了mysql::recordPage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: news_list
public function news_list()
{
// global $db, $config;
global $config;
$db = new mysql($config["db2"]);
$db->connect();
//排序
$set_sort = $this->set_sort();
//搜尋
$set_search = $this->news_list_set_search();
//SQL指令
$query_count = " SELECT count(*) as num ";
$query_record = "SELECT * ";
$query = "FROM `{$config['db'][2]['dbname']}`.`{$config['default_prefix']}news` n\n\t\t{$set_search['join_query']}\n\t\tWHERE \n\t\t\tn.prefixid = '{$config['default_prefix_id']}' \n\t\t\tAND unix_timestamp() >= unix_timestamp(n.ontime)\n\t\t\tAND n.switch = 'Y'\n\t\t";
//AND unix_timestamp() BETWEEN unix_timestamp(n.ontime) AND unix_timestamp(n.offtime)
$query .= $set_search['sub_search_query'];
$query .= $set_sort ? $set_sort : ' ORDER BY n.seq ';
//總筆數
$getnum = $db->getQueryRecord($query_count . $query);
$num = !empty($getnum['table']['record'][0]['num']) ? $getnum['table']['record'][0]['num'] : 0;
if ($num) {
//分頁資料
$page = $db->recordPage($num, $this);
$query_limit = " LIMIT " . ($page["rec_start"] - 1) . "," . $config['max_page'];
//取得資料
$table = $db->getQueryRecord($query_record . $query . $query_limit);
} else {
$table['table']['record'] = '';
}
if (!empty($table['table']['record'])) {
$table['table']['page'] = $page;
return $table;
}
return false;
}
示例2: product_flash_list_all
public function product_flash_list_all()
{
// global $db, $config;
global $config;
$db = new mysql($config["db2"]);
$db->connect();
//排序
$set_sort = $this->set_sort();
//搜尋
$set_search = $this->product_list_set_search();
//SQL指令
$query_count = " SELECT count(*) as num ";
$query_record = "SELECT distinct(p.productid) as ppp , p.*, unix_timestamp(p.offtime) as offtime, unix_timestamp() as `now`, pt.filename as thumbnail ";
// Not By Channel
$query = "FROM `{$config['db'][4]['dbname']}`.`{$config['default_prefix']}product` p \n\t\t{$set_search['join_query']}\n\t\tLEFT OUTER JOIN `{$config['db'][2]['dbname']}`.`{$config['default_prefix']}store_product_rt` sp ON \n\t\t\tp.prefixid = sp.prefixid\n\t\t\tAND p.productid = sp.productid\n\t\t\tAND sp.switch = 'Y'\n\t\tLEFT OUTER JOIN `{$config['db'][2]['dbname']}`.`{$config['default_prefix']}channel_store_rt` cs ON \n\t\t\tsp.prefixid = cs.prefixid\n\t\t\tAND sp.storeid = cs.storeid\n\t\t\tAND cs.switch = 'Y'\n\t\tLEFT OUTER JOIN `{$config['db'][4]['dbname']}`.`{$config['default_prefix']}product_thumbnail` pt ON \n\t\t\tp.prefixid = pt.prefixid\n\t\t\tAND p.ptid = pt.ptid\n\t\t\tAND pt.switch = 'Y'\n\t\tWHERE \n\t\t\tp.prefixid = '{$config['default_prefix_id']}'\n AND p.switch='Y'\n AND p.display='Y'\t\t\t\n\t\t\tAND p.is_flash = 'Y'\n\t\t\tAND sp.productid IS NOT NULL\n\t\t\tAND cs.channelid IS NOT NULL\n\t\t";
$query .= $set_search['sub_search_query'];
$query .= $set_sort ? $set_sort : " ORDER BY offtime ASC ";
//總筆數
$getnum = $db->getQueryRecord($query_count . $query);
$num = !empty($getnum['table']['record'][0]['num']) ? $getnum['table']['record'][0]['num'] : 0;
if ($num) {
//分頁資料
$page = $db->recordPage($num, $this);
$query_limit = " LIMIT 1 ";
// $query_limit = " LIMIT ". ($page["rec_start"]-1) .",". ($config['max_page']);
error_log("[m/product_flash_list_all] : " . $query_record . $query . $query_limit);
//取得資料
$table = $db->getQueryRecord($query_record . $query . $query_limit);
} else {
$table['table']['record'] = '';
}
if (!empty($table['table']['record'])) {
$table['table']['page'] = $page;
foreach ($table['table']['record'] as $tk => $tv) {
$productid = $tv['productid'];
//红利回馈
if ($tv['bonus_type'] == 'ratio') {
$table['table']['record'][$tk]['bonus'] = (double) sprintf("%0.2f", $tv['bonus']) . '%';
} elseif ($tv['bonus_type'] == 'value') {
$table['table']['record'][$tk]['bonus'] = (double) sprintf("%0.2f", $tv['bonus']) . '点';
} else {
$table['table']['record'][$tk]['bonus'] = 0;
}
// Relation product_rule_rt 下標條件關聯
$rule_rt = $this->get_product_rule_rt($productid);
$table['table']['record'][$tk]['srid'] = $rule_rt['srid'];
$table['table']['record'][$tk]['value'] = $rule_rt['value'];
}
return $table;
}
return false;
}
示例3: product_cancelled_list
public function product_cancelled_list()
{
// global $db, $config;
global $config;
$db = new mysql($config["db2"]);
$db->connect();
//排序
$set_sort = $this->set_sort();
//SQL指令
$query_count = " SELECT count(*) as num ";
$query_record = "SELECT p.*, unix_timestamp(p.offtime) as offtime, unix_timestamp() as `now`, pt.filename thumbnail ";
$query = "FROM `{$config['db'][4]['dbname']}`.`{$config['default_prefix']}product` p \n\t\tLEFT OUTER JOIN `{$config['db'][4]['dbname']}`.`{$config['default_prefix']}product_thumbnail` pt ON \n\t\t\tp.prefixid = pt.prefixid\n\t\t\tAND p.ptid = pt.ptid\n\t\t\tAND pt.switch = 'Y'\n\t\tLEFT OUTER JOIN `{$config['db'][2]['dbname']}`.`{$config['default_prefix']}store_product_rt` sp ON \n\t\t\tp.prefixid = sp.prefixid\n\t\t\tAND p.productid = sp.productid\n\t\t\tAND sp.switch = 'Y'\n\t\tLEFT OUTER JOIN `{$config['db'][2]['dbname']}`.`{$config['default_prefix']}channel_store_rt` cs ON \n\t\t\tsp.prefixid = cs.prefixid\n\t\t\tAND sp.storeid = cs.storeid\n\t\t\tAND cs.channelid = '{$_GET["channelid"]}'\n\t\t\tAND cs.switch = 'Y'\n\t\tWHERE \n\t\t\tp.prefixid = '{$config['default_prefix_id']}' \n\t\t\tAND closed = 'NB'\n\t\t\tAND p.switch = 'Y'\n\t\t";
$query .= $set_sort ? $set_sort : "ORDER BY p.offtime DESC";
//總筆數
$getnum = $db->getQueryRecord($query_count . $query);
$num = !empty($getnum['table']['record'][0]['num']) ? $getnum['table']['record'][0]['num'] : 0;
if ($num) {
//分頁資料
$page = $db->recordPage($num, $this);
$query_limit = " LIMIT " . ($page["rec_start"] - 1) . "," . $config['max_page'];
//取得資料
$table = $db->getQueryRecord($query_record . $query . $query_limit);
} else {
$table['table']['record'] = '';
}
if (!empty($table['table']['record'])) {
$table['table']['page'] = $page;
foreach ($table['table']['record'] as $tk => $tv) {
//市價
$table['table']['record'][$tk]['retail_price'] = number_format($tv['retail_price']);
//sprintf("%0.2f", $tv['retail_price']);
//流標原因
if ($this->bid_info($tv['productid']) < $tv['saja_limit']) {
$table['table']['record'][$tk]['memo'] = '未达' . $tv['saja_limit'] . '标';
} else {
$table['table']['record'][$tk]['memo'] = '无唯一流标';
}
}
return $table;
}
return false;
}
示例4: order_list
public function order_list($uid)
{
// global $db, $config;
global $config;
$db = new mysql($config["db2"]);
$db->connect();
//排序
$set_sort = $this->set_sort();
//搜尋
$set_search = $this->order_list_set_search();
//SQL指令
$query_count = " SELECT count(*) as num ";
$query_record = "SELECT o.* ";
$query = "FROM `{$config['db'][3]['dbname']}`.`{$config['default_prefix']}order` o \n\t\t{$set_search['join_query']}\n\t\tWHERE \n\t\t\to.prefixid = '{$config['default_prefix_id']}' \n\t\t\tAND o.userid = '{$uid}'\n\t\t\tAND o.confirm = 'Y'\n\t\t\tAND o.switch = 'Y'\n\t\t";
$query .= $set_search['sub_search_query'];
$query .= $set_sort ? $set_sort : "ORDER BY o.insertt DESC";
//總筆數
$getnum = $db->getQueryRecord($query_count . $query);
$num = !empty($getnum['table']['record'][0]['num']) ? $getnum['table']['record'][0]['num'] : 0;
if ($num) {
//分頁資料
$page = $db->recordPage($num, $this);
$query_limit = " LIMIT " . ($page["rec_start"] - 1) . "," . $config['max_page'];
//取得資料
$table = $db->getQueryRecord($query_record . $query . $query_limit);
} else {
$table['table']['record'] = '';
}
if (!empty($table['table']['record'])) {
$table['table']['page'] = $page;
$status = _v('status');
foreach ($table['table']['record'] as $tk => $tv) {
$table['table']['record'][$tk] = $tv;
if ($tv['type'] == 'saja') {
$query = "SELECT p.productid, p.name \n\t\t\t\t\tFROM `{$config['db'][4]['dbname']}`.`{$config['default_prefix']}pay_get_product` gp\n\t\t\t\t\tLEFT OUTER JOIN `{$config['db'][4]['dbname']}`.`{$config['default_prefix']}product` p ON \n\t\t\t\t\t\tp.prefixid = gp.prefixid\n\t\t\t\t\t\tAND p.productid = gp.productid\n\t\t\t\t\t\tAND p.switch = 'Y'\n\t\t\t\t\tWHERE \n\t\t\t\t\t\tgp.prefixid = '{$config['default_prefix_id']}' \n\t\t\t\t\t\tAND gp.pgpid = '{$tv['pgpid']}'\n\t\t\t\t\t\tAND gp.switch = 'Y'\n\t\t\t\t\t\tAND p.productid IS NOT NULL\n\t\t\t\t\t";
$recArr = $db->getQueryRecord($query);
$rs = isset($recArr['table']['record'][0]) ? $recArr['table']['record'][0] : '';
$table['table']['record'][$tk]['productid'] = $rs ? $rs['productid'] : '';
$table['table']['record'][$tk]['name'] = $rs ? $rs['name'] : '';
$table['table']['record'][$tk]['href'] = $rs ? APP_DIR . '/product/saja/?' . $status['status']['args'] . '&productid=' . $rs['productid'] : '';
} else {
$query = "SELECT p.epid, p.name \n\t\t\t\t\tFROM `{$config['db'][3]['dbname']}`.`{$config['default_prefix']}exchange_product` p\n\t\t\t\t\tWHERE \n\t\t\t\t\tp.prefixid = '{$config['default_prefix_id']}' \n\t\t\t\t\tAND p.epid = '{$tv['epid']}'\n\t\t\t\t\tAND p.switch = 'Y'\n\t\t\t\t\t";
$recArr = $db->getQueryRecord($query);
$rs = isset($recArr['table']['record'][0]) ? $recArr['table']['record'][0] : '';
$table['table']['record'][$tk]['productid'] = $rs ? $rs['epid'] : '';
$table['table']['record'][$tk]['name'] = $rs ? $rs['name'] : '';
$table['table']['record'][$tk]['href'] = $rs ? APP_DIR . '/mall/exchange/?' . $status['status']['args'] . '&epid=' . $tv['epid'] : '';
}
}
return $table;
}
return false;
}