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.


.



Relevant Pages

  • Strange problem
    ... syntax; check the manual that corresponds to your MySQL server version ... However, when I run the same query from mysql prompt, I get the desired ... which says "Unknown column passwd in hosting". ...
    (alt.php)
  • Inserting an Email Address fails.
    ... I'm trying to insert an email address into a mysql database and it seems ... neither of which works and both return pretty much the same error message. ... for the right syntax to use near 'From = 'KHamilton@Hunter.COM', ... I put MsgID first and the email address last it still dies on the mail ...
    (perl.dbi.users)
  • Re: Nochmal utf8
    ... `utf` LONGTEXT CHARACTER SET utf8 NOT NULL, ... Was ist an zweiter Syntax falsch? ... mysql> create table utf; ... Dito mit Deiner Query. ...
    (de.comp.datenbanken.mysql)
  • Re: mysql_query strangeness (misreported syntax error?)
    ... "You have an error in your SQL syntax; ... As far as I can tell, there are no syntax errors in my query. ... when I run in through the command line mysql client, ... considered a sub query and the PHP mysql_query not supporting sub ...
    (alt.php)
  • Re: Inserting an Email Address fails.
    ... > neither of which works and both return pretty much the same error message. ... > syntax. ... Check the manual that corresponds to your MySQL server version ... > I put MsgID first and the email address last it still dies on the mail ...
    (perl.dbi.users)