Calculating a sum value and also a count of records that exist on one table, but I have used two selects to achieve this.
The results from the two selects are two variables, $TotVal and $TotRes
Is there a way to get the two variables with one select?
$result = $db->query("SELECT SUM(value) AS TotVal FROM $table);
$result_array = mysql_fetch_array($result);
$TotVal = $result_array['TotVal'];
$result = $db->query("SELECT COUNT(id) AS TotRes FROM $table);
$result_array = mysql_fetch_array($result);
$TotRes = $result_array['TotRes'];