Re: Collecting info about columns in a table

From: Date: Sun, 29 Jan 2006 21:02:05 +0000
Subject: Re: Collecting info about columns in a table
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-229429@lists.php.net to get a copy of this message
Hi to all, I need to collect info about columns from a selected table. I use this: $result = mysql_query("SELECT * FROM ". $TableName); $fields = mysql_num_fields($result); for ($i=0; $i < $fields; $i++) { $type = mysql_field_type($result, $i); $name = mysql_field_name($result, $i); $len = mysql_field_len($result, $i); $flags = mysql_field_flags($result, $i); echo $type . " | " . $name . " | " . $len . " | " . $flags ."\n"; } If I have columns type ENUM('live', 'hidden', 'pending'), $flags will show ONLY 'enum'. How can I get all ENUM values? Thanks for any help or direction. -afan
-afan: $type = mysql_field_type($result, 'live'); $name = mysql_field_name($result, 'hidden'); $len = mysql_field_len($result, 'pending'); Provided that 'live', 'hidden', 'pending' are fields in your table. tedd -- -------------------------------------------------------------------------------- http://sperling.com/

« previous php.general (#229429) next »