Hi i have this script but need help editing it to so far this script shows how may tables and how many are in use. but i need it to exclude 3 tables in the database call user, room and class can anyone help with this modification of this php script thanks
[php]<?php
error_reporting(E_ALL);
// CONNECTION AND SELECTION VARIABLES FOR THE DATABASE
$db_host = “localhost”; // PROBABLY THIS IS OK
$db_name = “??”; // GET THESE FROM YOUR HOSTING COMPANY
$db_user = “??”;
$db_word = “??”;
// OPEN A CONNECTION TO THE DATA BASE SERVER
// MAN PAGE: http://php.net/manual/en/function.mysql-connect.php
if (!$db_connection = mysql_connect("$db_host", “$db_user”, “$db_word”))
{
$errmsg = mysql_errno() . ’ ’ . mysql_error();
echo "
NO DB CONNECTION: ";
echo "
$errmsg
";
}
// SELECT THE MYSQL DATA BASE
// MAN PAGE: http://php.net/manual/en/function.mysql-select-db.php
if (!$db_sel = mysql_select_db($db_name, $db_connection))
{
$errmsg = mysql_errno() . ’ ’ . mysql_error();
echo "
NO DB SELECTION: ";
echo "
$errmsg
";
die(‘NO DATA BASE’);
}
// IF WE GOT THIS FAR WE CAN DO QUERIES
// GET THE LIST OF TABLES
$sql = “SHOW TABLES”;
$res = mysql_query($sql) or die("FAIL: $sql
" . mysql_error() );
// CREATE AN ARRAY OF TABLE NAMES
$tables = array();
while ($row = mysql_fetch_array($res))
{
$tables[] = $row[0];
}
// GET THE COUNT OF TABLES
$total = count($tables);
// TEST EACH TABLE FOR ROWS OF DATA
$used = 0;
foreach ($tables as $table)
{
$sql = “SELECT * FROM $table LIMIT 1”;
$res = mysql_query($sql) or die("FAIL: $sql
" . mysql_error() );
$num = mysql_num_rows($res);
if ($num) $used++;
}
// SHOW THE WORK PRODUCT
echo “THERE ARE $total TABLES, AND THERE ARE $used WITH DATA”; [/php]