i have names of my tables in one table, i'm using that code:
require "./common.php";
$result = "Select * from ".$pho_main."";
$q->query($DB, $result);
$counter = 0;
$q->query($DB, $sql);
//Some HTML was here, i cut it out
while ($row = $q->getrow()){
$sSQL="select count() as posts from $row[table_name] where approved='Y'";
$tq = new query($DB, $sSQL);
if($tq->numrows()){
$trec=$tq->getrow();
$num_posts=$trec["posts"];
}
else{
$num_posts='0';
}
$sSQL = "SELECT author, count() as total FROM $row[table_name] GROUP BY 1 ORDER BY 2 DESC LIMIT 10";
$numb="0";
$tf = new query($DB, $sSQL);
while ($rowcount = $tf->getrow()){
$counter += $rowcount[1];
$total = $rowcount["total"];
$percentage = $total/$num_posts"100";
$rounded=round(100$percentage)/"100";
$author = $rowcount["author"];
$numb=++$numb;
echo "<tr bgcolor=\"#FFFFFF\"><td>$numb.</td><td> $author</td><td>$total</td><td>$rounded%</td></tr>";
//CUT
This outputs that:
http://www.pch.f2s.com/test.php
You can see that number on the left starts again every time it's going to the next table. I need to add all of them togather, ie if vulpes got 20 in one, 30 in other one, 49, 12, i need total of 118
Anybody got any ideas how to do it?
Vulpes