# SHOW TABLE STATUS in PHP



## sudhakararaog (Sep 6, 2007)

hi

I am using MySQL - 4.1.22 when i use the following sql query 
$result = mysql_query("SHOW tablename STATUS FROM databasename;");

i have also tried = $result = mysql_query("SHOW tablename STATUS FROM databasename");

i get the following error message

====================================================
1064 Error Message : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'tablename STATUS FROM databasename' at line 1 
====================================================

also with the following code 
===================================================
while($array = mysql_fetch_array($result)) 
{
$total = $array[Data_length]+$array[Index_length];

echo "
Table: ".$array[Name]."
Data Size: ".$array[Data_length]."
Index Size: ".$array[Index_length]."
Total Size: ".$total."
Total Rows: ".$array[Rows]."
Average Size Per Row: ".$array[Avg_row_length]."

";
}
=================================================

i get the following error = " mysql_fetch_array(): supplied argument is not a valid MySQL result resource "

please advice how to fix 
1) SHOW TABLE query for version 4.1.22 and also is there a difference in the SHOW TABLE query for MySQL - 3.23.58
2) while($array = mysql_fetch_array($result))

thanks a lot.


----------



## Anthony:-P (Nov 24, 2006)

Hi,

Welcome to TSG!

I would advise that you do not Multi-post across the board, or in the same forum. This does not get your problem resolved any quicker.

If you click the "little red triangle" at the top of your first post, and request a mod to lock / remove your thread.

I would advise that you use *your other thread to resolve this, as there is more detail in your question*.

Kind Regards,
Anthony


----------

