MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 7th, 2003, 06:07 PM
djf djf is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 1 djf User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
mysql schema

Where (how) is the schema for a table stored in a mysql db?
I would like to expand the attributes assigned to each column of a table by adding a description. My thoughts are to create a new table, called, lets say field_desc with the first column being equal to the "field" of a table definition, with the second being a description of the field.

The problem is I do not know how to access the table definition except with a show table. I would like to join my "new" table with the schema.

Overall objective is to produce a dynamic form based on the definition of a table, but not to use the field names in the form.

Reply With Quote
  #2  
Old March 8th, 2003, 04:36 AM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 7
Try this code:

PHP Code:
<?php
$link 
mysql_connect('localhost''mysql_user''mysql_password');

$fields mysql_list_fields("database1""table1"$link);
$columns mysql_num_fields($fields);

for (
$i 0$i $columns$i++) {
    echo 
mysql_field_name($fields$i) . "\n";
}


Also, you can use the following function:
mysql_field_type()

This will give you information on whether the field is "int", "real", "string", "blob", etc...
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > mysql schema


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT