$tb = $this->db->connection->prepare($sql); $tb->execute(); $this->arrC = $tb->fetch(PDO::FETCH_ASSOC); return $this->arrC; } function getUserLogin($userId){ $sql = 'SELECT * FROM inner_users WHERE user_login LIKE :userid'; $tb = $this->db->connection->prepare($sql); $tb->execute(array(':userid'=>$userId.'%')); $this->arrUserLogin = $tb->fetch(PDO::FETCH_ASSOC); } } //-- We count DB for DESC $getSumm = new mainpage_CountDB(); if($_GET['IU-filteruser']){ $arrUser = $getSumm->getUserLogin($_GET['IU-filteruser']); } if($_GET['IU-filtercats'] OR $_GET['IU-filtermoves']){ $BDsumm = $getSumm -> getDatafromtable($_GET['IU-filtercats'],$_GET['IU-filtermoves']); }else{ if($_GET['IU-filteruser']){ $BDsumm = $getSumm -> getDatafromtable($_GET['IU-filtercats'],$_GET['IU-filtermoves']); }else{ $BDsumm = $getSumm -> getSumm(); } }
<? session_start(); require 'db.php'; require 'secfile.php'; if($userLevel['oper_view_forw']==0){ exit; } class mainpage_CountDB{ public $arrC; public $db; function __construct(){ $this->db = new Database(); } function getSumm(){ $sql = 'SELECT COUNT(alias_id) as DbSumm FROM aliases'; $tb = $this->db->connection->prepare($sql); $tb->execute(); $this->arrC = $tb->fetch(PDO::FETCH_ASSOC); return $this->arrC; } } //-- We count DB for DESC $getSumm = new mainpage_CountDB(); $BDsumm = $getSumm -> getSumm(); echo json_encode($BDsumm) ?>
}else{ if(count($arrExc)>0){ $sql = 'SELECT COUNT(staff_id) as DbSumm FROM staff WHERE '.$strExp.''; $tb = $this->db->connection->prepare($sql); $tb->execute($arrExc); }else{ $sql = 'SELECT COUNT(staff_id) as DbSumm FROM staff'; $tb = $this->db->connection->prepare($sql); $tb->execute(); } } break; default: $sql = 'SELECT COUNT(staff_id) as DbSumm FROM staff'; $tb = $this->db->connection->prepare($sql); $tb->execute(); } //return $sql; $this->arrBest = $tb->fetch(PDO::FETCH_ASSOC); return $this->arrBest; } } //-- We count DB for DESC $getSumm = new mainpage_CountDB(); $DBsum = $getSumm -> getSumm($typePage,$_GET['staff_option'],$searchData,$_GET['valComp_filt'],$_GET['valDep_filt'],$_GET['valLoca_filt']); echo json_encode($DBsum) ?>