count colums and tables
Posted: Wed Oct 28, 2009 5:38 am
Code: Select all
// how to get the number of tables in a database in mysql
// how to get the total number of columns in a row
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
// how to get the number of tables in a database in mysql
// how to get the total number of columns in a row
ranjitbd wrote:// i came to know that the number of tables in the database like 20, 30 or 40Code: Select all
// how to get the number of tables in a database in mysql // how to get the total number of columns in a row
// show tables column will show the table name...
Code: Select all
// how to get the number of tables in a database in mysql
$result = mysql_query("SHOW TABLES FROM database_name");
$table_count = mysql_num_rows($result);Code: Select all
// how to get the total number of columns in a row
$result = mysql_query("SHOW COLUMNS FROM database_name.table_name");
$field_count = mysql_num_rows($result);Code: Select all
// how to get the total number of columns in a row
$result = mysql_query("DESCRIBE database_name.table_name");
$field_count = mysql_num_rows($result); Code: Select all
// how to get the total number of columns in a row
$result = mysql_query("SELECT * FROM database_name.table_name LIMIT 1");
$field_count = mysql_num_fields($result);