โดย M030 » 17/10/2015 2:01 pm
พอดีจะแบ่งหน้าเพจแบบ BB ค่ะ นอกจากข้อมูลที่เรา select ไว้ไม่ขึ้นแล้วเพจแบ่งหน้าก็ไม่ขึ้นค่ะ
โค้ด: เลือกทั้งหมด
else {
// $sql = 'SELECT province,district,subdistrict,zipcode
//FROM ' . $table_prefix . 'thailand';
$pagination = $phpbb_container->get('pagination');
$start = request_var('start',0);
$per_page = request_var('per_page', $config['topics_per_page']);
$result = $db->sql_query_limit($sql, $per_page, $start);
$sql_ary = array(
'SELECT id,province,district,subdistrict,zipcode
FROM ' => array(
$table_prefix . 'thailand' => 't',
),
);
$sql = $db->sql_build_query('SELECT', $sql_ary);
// $result = $db->sql_query_limit($sql, 20, 20);
while ($row = $db->sql_fetchrow($result)) {
//print_r($row);
$id = $row['id'];
$province = $row['province'];
$district = $row['district'];
$subdistrict = $row['subdistrict'];
$zipcode = $row['zipcode'];
$this->template->assign_block_vars('m_thai', array(
'ID' => $id,
'PROVINCE' => $province,
'DISTRICT' => $district,
'SUBDISTRICT' => $subdistrict,
'ZIPCODE' => $zipcode,
));
}
$sql_ary['SELECT'] = 'COUNT(t.id) as total_id';
$total_id = $db->sql_fetchfield('total_id');
$base_url = $this->m_action ;
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_id,$per_page,$start);
}
พอดีจะแบ่งหน้าเพจแบบ BB ค่ะ นอกจากข้อมูลที่เรา select ไว้ไม่ขึ้นแล้วเพจแบ่งหน้าก็ไม่ขึ้นค่ะ
[attachment=0]debug-selectpage.png[/attachment]
[code=php]
else {
// $sql = 'SELECT province,district,subdistrict,zipcode
//FROM ' . $table_prefix . 'thailand';
$pagination = $phpbb_container->get('pagination');
$start = request_var('start',0);
$per_page = request_var('per_page', $config['topics_per_page']);
$result = $db->sql_query_limit($sql, $per_page, $start);
$sql_ary = array(
'SELECT id,province,district,subdistrict,zipcode
FROM ' => array(
$table_prefix . 'thailand' => 't',
),
);
$sql = $db->sql_build_query('SELECT', $sql_ary);
// $result = $db->sql_query_limit($sql, 20, 20);
while ($row = $db->sql_fetchrow($result)) {
//print_r($row);
$id = $row['id'];
$province = $row['province'];
$district = $row['district'];
$subdistrict = $row['subdistrict'];
$zipcode = $row['zipcode'];
$this->template->assign_block_vars('m_thai', array(
'ID' => $id,
'PROVINCE' => $province,
'DISTRICT' => $district,
'SUBDISTRICT' => $subdistrict,
'ZIPCODE' => $zipcode,
));
}
$sql_ary['SELECT'] = 'COUNT(t.id) as total_id';
$total_id = $db->sql_fetchfield('total_id');
$base_url = $this->m_action ;
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_id,$per_page,$start);
}
[/code]