SHOW TABLE STATUS

This is a discussion on SHOW TABLE STATUS within the PHP Language forums, part of the PHP Programming Forums category; hi I am using MySQL - 4.1.22 when i use the following sql query $result = mysql_query("SHOW tablename ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-29-2008
Sudhakar
 
Posts: n/a
Default SHOW TABLE STATUS

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]."<br />
Data Size: ".$array[Data_length]."<br />
Index Size: ".$array[Index_length]."<br />
Total Size: ".$total."<br />
Total Rows: ".$array[Rows]."<br />
Average Size Per Row: ".$array[Avg_row_length]."<br /><br />";
}
=================================================

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.
Reply With Quote
  #2 (permalink)  
Old 01-29-2008
Jerry Stuckle
 
Posts: n/a
Default Re: SHOW TABLE STATUS

Sudhakar wrote:
> 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]."<br />
> Data Size: ".$array[Data_length]."<br />
> Index Size: ".$array[Index_length]."<br />
> Total Size: ".$total."<br />
> Total Rows: ".$array[Rows]."<br />
> Average Size Per Row: ".$array[Avg_row_length]."<br /><br />";
> }
> =================================================
>
> 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.
>


This is a MySQL error. Try comp.database.mysql.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Reply With Quote
  #3 (permalink)  
Old 01-30-2008
The Natural Philosopher
 
Posts: n/a
Default Re: SHOW TABLE STATUS

Jerry Stuckle wrote:
> Sudhakar wrote:
>> 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]."<br />
>> Data Size: ".$array[Data_length]."<br />
>> Index Size: ".$array[Index_length]."<br />
>> Total Size: ".$total."<br />
>> Total Rows: ".$array[Rows]."<br />
>> Average Size Per Row: ".$array[Avg_row_length]."<br /><br />";
>> }
>> =================================================
>>
>> 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.
>>

>
> This is a MySQL error. Try comp.database.mysql.
>


Oh sod off jerry.

The syntax is SHOW TABLE STATUS FROM 'database' (LIKE..)

That shows all the tables in the databse with useless info on them

If you want more on a specific table, then SHOW FIELDS FROM table (FROM
database)

etc works. As do SHOW INDEX, SHOW COLUMNS etc etc.

Get yourself an MySQL syntax book. When in doubt use the command line
tool to check syntax.


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 09:58 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0