assign("metatags",$metatags); $smarty->assign("logged_in",$logged_in); $smarty->assign("left_panel",$left_panel); $smarty->assign("ephpb2b_username",$ephpb2b_username); /******************* needs to be checked always for the left panel ends *****/ if($_GET["sort"]!="") { if($_GET["str"]=="com" ) { $sortoption=$_GET["str"]; $sorttable="ieg_companyprofiles"; $sortby=addslashes($_GET["sort"]); if($_GET["sort"]=="A") { $sortcond=""; for($i=1;$i<=10;$i++) { $sortcond.="es_companyname like '$i%' or "; } $sortcond.="es_approved='yes' and es_companyname like 'A%' "; } elseif($_GET["sort"]=="xyz") { $sortcond=""; $sortcond="es_approved='yes' and es_companyname like 'x%' or es_companyname like 'y%' or es_companyname like 'z%'"; } else { $sortcond=""; $sortcond="es_approved='yes' and es_companyname like '$sortby%' "; } } elseif($_GET["str"]=="sell") { $sortoption=$_GET["str"]; $sorttable="ieg_offers"; $sortby=$_GET["sort"]; if($_GET["sort"]=="A") { $sortcond=""; for($i=1;$i<=10;$i++) { $sortcond.="es_approved='yes' and es_title like '$i%' or "; } $sortcond.="es_approved='yes' and es_title like 'A%' "; } elseif($_GET["sort"]=="XYZ") { $sortcond=""; $sortcond="es_approved='yes' and es_title like 'X%' or es_title like 'Y%' or es_title like 'Z%'"; } else { $sortcond=""; $sortcond="es_approved='yes' and es_title like '$sortby%' "; } } elseif($_GET["str"]=="buy") { $sortoption=$_GET["str"]; $sorttable="ieg_offers_buy"; $sortby=$_GET["sort"]; if($_GET["sort"]=="a") { $sortcond=""; for($i=1;$i<=10;$i++) { $sortcond.="es_approved='yes' and es_title like '$i%' or "; } $sortcond.="es_approved='yes' and es_title like 'A%' "; } elseif($_GET["sort"]=="XYZ") { $sortcond=""; $sortcond="es_approved='yes' and es_title like 'X%' or es_title like 'Y%' or es_title like 'Z%'"; } else { $sortcond=""; $sortcond="es_approved='yes' and es_title like '$sortby%' "; } } elseif($_GET["str"]=="product") { $sortoption=$_GET["str"]; $sorttable="ieg_products"; $sortby=$_GET["sort"]; if($_GET["sort"]=="A") { $sortcond=""; for($i=1;$i<=10;$i++) { $sortcond.="es_approved='yes' and es_title like '$i%' or "; } $sortcond.="es_approved='yes' and es_title like 'A%' "; } elseif($_GET["sort"]=="XYZ") { $sortcond=""; $sortcond="es_approved='yes' and es_title like 'X%' or es_title like 'Y%' or es_title like 'Z%'"; } else { $sortcond=""; $sortcond="es_approved='yes' and es_title like '$sortby%' "; } } } $type = $_GET["str"]; //echo $type; $root_path= ROOTPATH; if(isset($_GET['fpage'])) $fpage=$_GET['fpage']; else $fpage=1; $font=""; $closefont=""; if($sortoption=="com") { $field=" es_id , es_companyname "; //$sorttable='TBL_COMPANYPROFILES'; $sorttable='ieg_companyprofiles'; $table='ieg_companyprofiles'; } elseif($sortoption=="sell") { $field=" es_id , es_title "; $sorttable="ieg_offers"; $table='ieg_offers'; } elseif($sortoption=="buy") { $field=" es_id , es_title "; $sorttable="ieg_offers_buy"; $table='ieg_offers_buy'; } elseif($sortoption=="product") { $field=" es_id , es_title "; $sorttable="ieg_products"; $table='ieg_products'; } $PageSize = 80; //GETS THE STARTING AND ENDING INDEX AS PER THE CURRENT PAGE $records_start_end = get_index_records($PageSize); $StartRow = $start; // GETS THE STARTING INDEX NUMBER $PageSize = $limit; // GETS THE NO OF RECORDS TO BE DISPLAYED IN ONE PAGE $issue_query = "SELECT ".$field." FROM ".$sorttable." where 1 and ".$sortcond.""; //$issue_query = $issue_query . " ORDER BY es_id desc"; //echo "
".$issue_query; $rs = mysql_query($issue_query); $prepared_query = build_query($StartRow, $PageSize, $conn, $issue_query); //print_r($prepared_query); $query = $prepared_query[0]; //GETS THE SQL QUERY $Total_Record = $prepared_query[1]; //STORES THE TOTAL NUMBER OF RECORDS RETURNED BY THE QUERY //echo $Total_Record; $rs = mysql_query($query); if(!$rs) { echo mysql_error(); exit; } if($Total_Record<=0) $str="No Results Found"; else { //echo $start."
"; //echo $limit; $i=0; //$str=""; //while($rsq=mysql_fetch_array($qstr,MYSQLI_BOTH)) //for($i=0;$i<$Total_Record;$i++) //$str.="
"; while($rec = mysql_fetch_array($rs)) { //$i++; //echo $i; if($sortoption=="com") { $comp=$rec["es_companyname"]; $comp= str_replace(" ",'-',$comp); $comp= str_replace("/",'-',$comp); $comp= str_replace(",",'',$comp); $comp= str_replace("&",'and',$comp); $comp= str_replace("%",'-',$comp); $comp= str_replace("?",'-',$comp); $id=$rec["es_id"]; /*$str.="
  • ".substr($qstr[$i][1],0,28)."..."."
  • ";*/ $str.=""; } if($sortoption=="sell") { $comp=$rec["es_title"]; $comp= str_replace(" ",'-',$comp); $comp= str_replace("/",'-',$comp); $comp= str_replace(",",'',$comp); $comp= str_replace("&",'and',$comp); $comp= str_replace("%",'-',$comp); $comp= str_replace("?",'-',$comp); $id=$rec["es_id"]; /*$str.="
  • ".substr($qstr[$i][1],0,28)."..."."
  • ";*/ $str.=""; } if($sortoption=="buy") { $comp=$rec["es_title"]; $comp= str_replace(" ",'-',$comp); $comp= str_replace("/",'-',$comp); $comp= str_replace(",",'',$comp); $comp= str_replace("&",'and',$comp); $comp= str_replace("%",'-',$comp); $comp= str_replace("?",'-',$comp); $id=$rec["es_id"]; /*$str.="
  • ".substr($qstr[$i][1],0,28)."..."."
  • ";*/ $str.=""; } if($sortoption=="product") { $comp=$rec["es_title"]; $comp= str_replace(" ",'-',$comp); $comp= str_replace("/",'-',$comp); $comp= str_replace(",",'',$comp); $comp= str_replace("&",'and',$comp); $comp= str_replace("%",'-',$comp); $comp= str_replace("?",'-',$comp); $id=$rec["es_id"]; /*$str.="
  • ".substr($qstr[$i][1],0,28)."..."."
  • ";*/ $str.=""; } } // for //$str.="
    "; } //str ends //pagination starts here //pagination ends here $smarty->assign("mode","alphabeticsort"); $smarty->assign("func",$func); $smarty->assign("type",$type); $smarty->assign("str",$str); //$smarty->assign("str2",$str2); $smarty->assign("sort",$sort); if($Total_Record > 80) { $pagination_path = "alphabeticsort.php"; $params = ""; $params .= "&sort=$sortby&str=$sortoption"; $params .= $page_link; $pg = func_paginate($start, 80, $Total_Record, $pagination_path, $params); // include/search_function.php //$pg = do_paging($conn, "alphabeticsort.php", "&sort=$sortby&str=$sortoption", $PageSize, $issue_query); $smarty->assign("pagination",$pg); } $smarty->assign("root_path",ROOTPATH); $smarty->assign("sortoption",$sortoption); $smarty->display("index.tpl"); ?>