i got sql:
SELECT author, count(*) as total FROM $ForumTableName GROUP BY 1 ORDER BY 2 DESC LIMIT 10

what it do, is that it select from ONE table, count authors and outputs it in the HTML table. I have problems selecting form ALL tables(these table names are stored in the table called "tables"), counts authors form all of them, and outputs it in the HTML table.

So i need some sort of code for all table count.

Sorry for my bad English.

Vulpes

    $result = mysql_query("Select * from tables");
    $counter = 0;
    while ($row = mysql_fetch_array($result)){

    $resultcount = mysql_query("SELECT author, count(*) as total FROM $row['table_name'] GROUP BY 1 ORDER BY 2 DESC LIMIT 10");

    while ($rowcount = mysql_fetch_row($resultcount)){
    $counter += rowcount[1];
    }
    }

    I'm not sure if this is what you want 😉

      Ok, i tryed it, but right here:

      $counter += rowcount[1];

      PHP says:
      Parse error: parse error in test.php on line 16

      What's wrong, and what is rowcount?

        Yes! It's working(you forgot "$") but, as i think, your code makes SQL for every table in tables. But how to make it count and add all those total authors togater?

          Write a Reply...