Chatrapati Posted August 20, 2013 Share Posted August 20, 2013 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]; Quote Link to comment Share on other sites More sharing options...
Barand Posted August 20, 2013 Share Posted August 20, 2013 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); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.