Re: get emum values

From: Date: Sun, 24 Feb 2002 19:27:32 +0000
Subject: Re: get emum values
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-86005@lists.php.net to get a copy of this message
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 * and then Jason Wong declared.... > Not sure whether there is a built-in function for doing so. But here's > something I prepared earlier: > > function create_list_from_ENUM($dbh, $table, $column) { > $sth = $dbh->prepare("SHOW COLUMNS FROM $table LIKE '$column'"); > if ($sth) { > $sth->execute(); > while ($row = $sth->fetchrow_hash()) { > ereg("('(.*)')", $row[1], $temp); > $array = explode( "','", $temp[2] ); > while (list ($key, $val) = each ($array)) { > $return[] = "$val"; > } > } > } > return $return; > } Yep, It's come back to me now. Your right of course there is no php function for this, it's the 'show columns' sql that does the trick. Cheers! - -- - ----------------------------------------------------------- www.explodingnet.com | Projects, Forums and + Articles for website owners - -- Nick Wilson -- | and designers. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8eT6kHpvrrTa6L5oRAkQ3AJkB9oYyoidJUlfyUF9LZYe0nUh/rACdGOUj LkdsHqhrHequJVuhKGi/HLM= =hbeU -----END PGP SIGNATURE-----

« previous php.general (#86005) next »