โค้ด: เลือกทั้งหมด
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
$user->session_begin();
$auth->acl($user->data);
$user->setup(test_insert_sql);
$template->set_filenames(array(
'body' => 'test_insert_sql_history.html'
));
$search = request_var('search',''); //รับค่าจากดอปดาวในhtml รูปแบบ(20000-30000)
$s1 = explode('-',$search); //แบ่งข้อความ
$a = $s1[0]; //20000เกบในa
$b = $s1[1];//30000เกบในb
$min = request_var('min', $a);//ถ้ามีการกดหน้า2 จะรับค่าminเกบในmin
$max = request_var('max', $b);
$start = request_var('start', 0); //เริ่มจากลำดับ
$limit = request_var('limit', (int)5 );// จำนวนที่จะให้เเสดง
if($search == '100000+'){
$data = 'SELECT * FROM ' . OFFING_TABLE . ' WHERE sa_total > 100000 order by search_id ASC';
$row = "SELECT COUNT(*) AS sumrow FROM ". OFFING_TABLE.' WHERE sa_total > 100000 order by search_id ASC';
}
//เกือบทุกเงื่อนไขจะเข้าตัวนี้
else{
$data = 'SELECT * FROM '.OFFING_TABLE.' where sa_total between "'.$min.'" and "'.$max.'" order by search_id ASC';
$row = "SELECT COUNT(*) AS sumrow FROM ". OFFING_TABLE.' where sa_total between "'.$min.'" and "'.$max.'" order by search_id ASC';
}
$result = $db->sql_query($row);
$total_data = (int) $db->sql_fetchfield('sumrow');
$result = $db->sql_query_limit($data, $limit, $start);
while($show = $db->sql_fetchrow($result)){
$template->assign_block_vars('somerow', array(
'VAR1' => "$show[name]",
'VAR2' => "$show[sa_m]",
'VAR3' => "$show[sa_f]",
'VAR4' => "$show[age_m]",
'VAR5' => "$show[age_f]",
'VAR6' => "$show[status_l]",
'VAR7' => "$show[status_c]",
'VAR8' => "$show[status_ma]",
'VAR9' => "$show[status_f]",
'VAR10' => "$show[status_ceo]",
'VAR11' => "$show[time]",
'VAR12' => "$show[money]",
'VAR13' => "$show[ip]",
));
}
$pagination_url = append_sid($phpbb_root_path . 'test_insert_sql_history.' . $phpEx."?min=".$min."&max=".$max,'');
$template->assign_vars(array(
'PAGINATION' => generate_pagination($pagination_url, $total_data, $limit, $start),
'PAGE_NUMBER' => on_page($total_use, $limit, $start),
));
make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
page_header($l_title, false);
page_footer();
?>
มีข้อมูลในฐานข้อมูล10record
หน้าค้นหา หน้าแรก หน้า2