Hello all, thanks for reading my little post...My question is can i merge and SELECT and a SELECT COUNT () AS Num.
I'm wondering if I can do something as simple as this
SELECT , COUNT() AS Num
But then how do I access count?
Curently I'm using
This is the Queries
$Sql = "SELECT * FROM `Blog` ORDER BY `Date`";
$SqlCnt = "SELECT count(*) AS `num` FROM `Blog`";
This is the db
$sql = $Sql ." {$SqlAdd} LIMIT $From, $MaxRowsPP";
$getlist = db_res( $sql );
$Paginate['RowList'] = $getlist;
$Paginate['TESTSQL'] = $sql;
Then later on I do a count
$getcount = db_res( $SqlCnt );
$total_results = mysql_result($getcount, 0) - 1;
$TotalPages = ceil( $total_results / $MaxRowsPP );
db_res is a custom function that returns
mysql_query( $Query, $MySQL->link );
My goal here is to combine if possible
$getcount = db_res( $SqlCnt );
$total_results = mysql_result($getcount, 0) - 1;
AND
$sql = $Sql ." {$SqlAdd} LIMIT $From, $MaxRowsPP";
$getlist = db_res( $sql );
Into ONE db_res i.e. one mysql_query and get rid of mysql_result($getcount, 0) - 1; ...Is there away?