Rows($sql_num); $num2 = $r_num[0]['num2']; #-------------------------------------------------------------------------- if(isset($_REQUEST['id']) && intval($_REQUEST['id'])) { $ca_id = intval($_REQUEST['id']); $WHERE.=" AND A1.ca_id = '$ca_id' "; $strURL.='id='.$id."&"; } if(isset($_REQUEST['display']) && intval($_REQUEST['display'])) { $display = intval($_REQUEST['display']); $strURL.='display='.$display."&"; } if(isset($_REQUEST['page']) && intval($_REQUEST['page'])) { $page1 = intval($_REQUEST['page']); } if(isset($_REQUEST['txtKEYWORD']) && trim($_REQUEST['txtKEYWORD'])<>"") { $txtKEYWORD = trim($_REQUEST['txtKEYWORD']); $WHERE.=" AND A1.pro_name like '%$txtKEYWORD%' "; $strURL.='txtKEYWORD='.$txtKEYWORD."&"; } #-------------------------------------------------------------------------- if($display == 2) { $sql = "SELECT A1.*, A4.ca_name, A2.main_name, A2.account,A3.mn_name, date_format(A1.date_added,'%d-%m-%Y %H:%i:%s') as date_added FROM tbl_product as A1 left join tbl_company as A2 on A1.co_id = A2.co_id left join tbl_money as A3 on A1.mn_id = A3.mn_id left join tbl_category as A4 on A4.ca_id = A1.ca_id WHERE A1.prot_id = 1 ".$WHERE." ORDER BY A1.pro_vip_id ASC, A1.date_added DESC "; $result = mysql_query($sql) or die("Not query"); $total_records=@mysql_num_rows($result); $record_per_page=$num2; $scroll=10; $page->set_qry_string($strURL); $page->set_page_data("company_products.php",$total_records,$record_per_page,$scroll,true,true,true); $i=0; $r = array(); $r2 = array(); $result_display = mysql_query($page->get_limit_query($sql)); while($rows_display = mysql_fetch_array($result_display)) { $i++; if($i==1) $r[] = $rows_display; else if($i==2) { $r2[] = $rows_display; $i=0; } } $showPage=$page->get_page_nav(); $total_page=$page->total_page; $fN = $n_page*$record_per_page + 1; $tN = ($n_page+1)*$record_per_page; if($tN > $total_records) $tN=$total_records; $strURL1 = "company_products2.tpl"; } else { $sql = "SELECT A1.*, A4.ca_name, A2.main_name,A2.account, A3.mn_name, date_format(A1.date_added,'%d-%m-%Y %H:%i:%s') as date_added FROM tbl_product as A1 left join tbl_company as A2 on A1.co_id = A2.co_id left join tbl_money as A3 on A1.mn_id = A3.mn_id left join tbl_category as A4 on A4.ca_id = A1.ca_id WHERE A1.prot_id = 1 ".$WHERE." ORDER BY A1.pro_vip_id ASC, A1.date_added DESC "; $result = mysql_query($sql) or die("Not query"); $total_records=@mysql_num_rows($result); $record_per_page=$num2+10; $scroll=10; $page->set_qry_string($strURL); $page->set_page_data("company_products.php",$total_records,$record_per_page,$scroll,true,true,true); $r1 = array(); $r2 = array(); $r3 = array(); $r4 = array(); $result_display = mysql_query($page->get_limit_query($sql)); while($rows_display = mysql_fetch_array($result_display)) { $i++; $j++; if($i==1) $r1[] = $rows_display; else if($i==2) $r2[] = $rows_display; else if($i==3) $r3[] = $rows_display; else if($i==4) { $r4[] = $rows_display; $i=0; } } $showPage=$page->get_page_nav(); $total_page=$page->total_page; $fN = $n_page*$record_per_page + 1; $tN = ($n_page+1)*$record_per_page; if($tN > $total_records) $tN=$total_records; $strURL1 = "company_products.tpl"; } #BANNER $sqlBanner = "SELECT * FROM tbl_banner WHERE ba_id = 3"; $rB = $db->Rows($sqlBanner); $smarty->assign('rB',$rB); #CATEGORY $sql3 = "SELECT * FROM tbl_category"; $r3_id = $db->RowsField($sql3,'ca_id'); $r3_name = $db->RowsField($sql3,'ca_name'); #-------------------------------------------------------------------------- $smarty->assign("showPage",$showPage); $smarty->assign("total_page",$total_page); $smarty->assign("total_records",$total_records); $smarty->assign("fN",$fN); $smarty->assign("tN",$tN); $smarty->assign("ca_id",$ca_id); $smarty->assign("strURL",$strURL); $smarty->assign("r",$r); $smarty->assign("r1",$r1); $smarty->assign("r2",$r2); $smarty->assign("r3",$r3); $smarty->assign("r4",$r4); $smarty->assign('ca_name',$ca_name); #-------------------------------------------------------------------------- $smarty->display($template_root.$strURL1); ?>