-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Karen Chu wrote:

> Thanks for the reply!
> Please see my pseudo code below. @@@ mark is the place where my
> questions come from. I wonder if it is doable in MySQL.
>
> I wish to have code like this: (@@@ is where my questions come from)
> // connect to the DB
>
> // list all table names in the dtabase
> print "<tr><td bgcolor=#1A4D80 align=center>$table
> Table</font></td></tr>";
>
> //@@@@
> $query_all_tables = "select name from all_tables ='$table'";

You could just replace this with 'SHOW TABLES' in MySQL, or if you need
to match a particular table name or name pattern, you can add a LIKE
clause at the end, see:

http://www.mysql.com/doc/en/SHOW.html

> $result_table_names = mysql_query($query_all_tables) or die("no tables
> were ever defined\n");
> $row_table_name = mysql_fetch_array($result_table_names);
> $table_in_db = $row_table_name["Tables in the DB"];
> ...
> // once a table is selected, let's try to get all fields information in
> this table
> //@@@
> $query_all_fields - "select column_name from all_columns where
> table_name ='$selected_table'";

Here you would just use 'SHOW COLUMNS FROM [tablename]' substituting
whatever table name you wanted.

        -Mark

- --
For technical support contracts, visit https://order.mysql.com/?ref=mmma

    __  ___     ___ ____  __
   /  |/  /_ __/ __/ __ \/ /  Mark Matthews <[EMAIL PROTECTED]>
  / /|_/ / // /\ \/ /_/ / /__ MySQL AB, SW Dev. Manager - J2EE/Windows
 /_/  /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA
        <___/ www.mysql.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+5MJ5tvXNTca6JD8RAqyaAJ99dRIGebW0WYUFZsHTU9YHMbDF6gCfb39w
Km5B97EbYIJVM30MUY/DUrQ=
=Wo3Q
-----END PGP SIGNATURE-----


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to