Re: List tables
| From: | Alin | Date: | Thu, 20 Mar 2003 15:14:01 +0000 |
| Subject: | Re: List tables | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-140437@lists.php.net to get a copy of this message | ||
On Thu, 2003-03-20 at 17:09, Alin wrote:
> if you are using mysql try:
>
> $query="show tables";
> $result=mysql_db_query("database-name",$query) or die("Query error");
> whlie(list($table-name)=mysql_fetch_row($result)){
> echo "Columns from $table-name: <br>";
> $query="show columns from $table-name;";
> $result=mysql_db_query("database-name",$query) or die("Query error");
> while($columns[]=mysql_fetch_row($result)){
> echo" $columns[0]<br>";
> }
> }
> Alin Brindusescu
> CareNer Romania
> alinoz@mycarenet.com
>
>
>
>
> On Wed, 2003-03-26 at 19:37, shaun wrote:
> > Hi,
> >
> > i would like to list all of the tables and field names in my database
> >
> > e.g.
> >
> > table 1
> > field 1
> > field 2
> > field 3
> > table 2
> > field 1
> > field 2
> > field 3
> > table 3
> > field 1
> > field 2
> > field 3
> > etc
> >
> > is there a simple way to do this?
> >
> > thanks for your help
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>