Jump to content

how To Count the total rows in 10 tables,


Chatrapati

Recommended Posts

how to COUNT the total rows in 10 tables,

 

example :friendshipsms[500]

 

how to count the rows in 10 tables?

 

 

i tried this but did'nt work?

 

$sql="SELECT COUNT(*) FROM table1,table2,table3,table4,table5";

 

$result=mysql_query($sql);

 

$numrows=mysql_fetch_row($result);

 

echo $numrows[0];

You can query the "Tables" table in the "Information_schema" database.

$db = new mysqli(HOST, USERNAME, PASSWORD, 'information_schema');

$sql = "SELECT table_name, table_rows 
        FROM tables 
        WHERE table_schema = 'yourDatabaseName'
        AND table_name IN ('table1', 'table2')";
$db->query($sql);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.