Re: mysql table information
| From: | David Robley | Date: | Sun, 04 Nov 2001 23:45:02 +0000 |
| Subject: | Re: mysql table information | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-73428@lists.php.net to get a copy of this message | ||
On Sat, 3 Nov 2001 00:32, Justin French wrote:
> hi,
>
> i was wondering if anyone has some sample code / links which could help
> me generate HTML forms dynamically from the fields/types/lengths of
> tables in a mySQL database.
>
> ie, if i had a three column table with first (varchar 50), last
> (varchar 80) & bio (medium text) as the columns, it'd be great if i
> could use this information about the *table* to build a html form.
>
> in otherwords, I could generate an <INPUT> named "first" who's max
> length was 50, annother called "last" with a maxlength of 80, and a
> <TEXTAREA> named "bio" for the medium text, etc etc.
>
>
> sorry i can't describe it any better!!
>
>
> i guess programs like phpMyAdmin achieve this, but i'd rather see a
> small code snippet and LEARN rather than dig through 1000's of lines of
> phpMyAdmin code :)
>
Justin
You might want to have a look at mysql_field_name and mysql_field_type.
There is an example in the docs for the latter that I think will point
you in the right direction.
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
Everywhere is walking distance if you have the time.