I have this page http://www.designsearchassociates.com/salary-poll/php/listing.php?hdnSearchCategory=all&hdnCurrentPageNo=1&hdnSortField=id&hdnSortOrder=DESC where you can choose to view all entries or choose to sort by subject. It also shows the total submissions. Right now, when you choose to view by a particular topic (for example, select a region - California) the total submissions only shows for those results (which right now is 1). I'd like to show the total results not just for California (which right now is 4).
Here's the code I have now:
recPerPage = 10;
$searchCategory = $_REQUEST['hdnSearchCategory'];
$searchCriteria = $_REQUEST['hdnSearchCriteria'];
$currentPageNo = $_REQUEST['hdnCurrentPageNo'];
$sortField = $_REQUEST['hdnSortField'];
$sortOrder = $_REQUEST['hdnSortOrder'];
$startLimit = ($currentPageNo * $recPerPage) - $recPerPage;
$sql = "";
$sqlResultSet = "";
if($searchCategory == "all"){
$sql = "SELECT COUNT( * ) FROM `salarypoll`";
$sqlResultSet = "select jobtitle, salaryrange, firm, firmsize, projectsector, subsector, region, education from salarypoll ORDER BY `".$sortField."` ".$sortOrder." LIMIT ".$startLimit." , ".$recPerPage;
}else{
$sql = "SELECT COUNT( * ) FROM `salarypoll` where ".$searchCategory." like '".$searchCriteria."'" ;
$sqlResultSet = "select jobtitle, salaryrange, firm, firmsize, projectsector, subsector, region, education from salarypoll where ".$searchCategory." like '".$searchCriteria."' ORDER BY `".$sortField."` ".$sortOrder." LIMIT ".$startLimit." , ".$recPerPage;
}
$res_sel = $objDb->sql_query($sql);
$totalRec = $res_sel[0][0];
$totalPage = ceil($totalRec / $recPerPage);
$res_sel= $objDb->sql_query($sqlResultSet);
The the total submission show like this:
Total submissions to date: <? echo $totalRec ?>
Let me know if this is confusing (probably is, sorry). Thanks for any help!