Hi. This is the qmail-send program at toye.php.net.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.
<[EMAIL PROTECTED]>:
ezmlm-manage: fatal: message already has a Mailing-List header (maybe I should be a
sublist) (#5.7.2)
--- Below this line is a copy of the message.
Return-Path: <[EMAIL PROTECTED]>
Received: (qmail 27556 invoked from network); 24 Jan 2001 17:35:01 -0000
Received: from unknown (HELO snipe.prod.itd.earthlink.net) (207.217.120.62)
by va.php.net with SMTP; 24 Jan 2001 17:35:01 -0000
Received: from michaelbowman (sdn-ar-011orportP206.dialsprint.net [63.180.14.118])
by snipe.prod.itd.earthlink.net (EL-8_9_3_3/8.9.3) with SMTP id JAA19084
for <[EMAIL PROTECTED]>; Wed, 24 Jan 2001 09:37:28 -0800 (PST)
From: "Mike" <[EMAIL PROTECTED]>
Received: from toye.php.net ([198.186.203.33]) by vespasian.mspring.net (Mindspring
Mail Service) with SMTP id t1lb6s.ebe.37kbpqe for <[EMAIL PROTECTED]>; Tue, 21
Nov 2000 12:11:56 -0500 (EST)
To: <[EMAIL PROTECTED]>
Received: (qmail 20675 invoked by uid 1013); 21 Nov 2000 17:10:09 -0000
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
list-help: <mailto:[EMAIL PROTECTED]>
List-Unsubscribe: <mailto:[EMAIL PROTECTED]>
list-post: <mailto:[EMAIL PROTECTED]>
Delivered-To: mailing list [EMAIL PROTECTED]
Received: (qmail 20664 invoked from network); 21 Nov 2000 17:10:08 -0000
X-Priority: 3
X-MSMail-Priority: Normal
Priority: Normal
MIME-Version: 1.0
Content-Type: text/plain;
charset="ISO-8859-1"
X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Content-Transfer-Encoding: quoted-printable
X-Mailer: Microsoft Outlook Express 5.50.4522.1200
Date: Wed, 24 Jan 2001 09:39:06 -0800
Subject: Re: [PHP-DB] Get all the enum values from a Mysql column?
Message-ID: <[EMAIL PROTECTED]>
Addressed to: John Guynn <[EMAIL PROTECTED]>
[EMAIL PROTECTED]
** Reply to note from John Guynn <[EMAIL PROTECTED]> Tue, 21 Nov 2000=
10:32:43 -0600
>
> Is there an easy way to get all the enum values from a column?
>
> For example I have an enum column with the values
> "Astro","Camaro","Firehawk","Neon" and I would like to pull those values
> out to put in as <option>s in a html form with <select>.
>
> I've read the mysql maunal about pulling all the values from and enum
> column, "If you want to get all possible values for an ENUM column, you
> should use: SHOW COLUMNS FROM table_name LIKE enum_column_name and parse
> the ENUM definition in the second column." For some reason I can't make
> heads or tails of this.
Do you have access to command line MySQL? If so, the first thing to do is
fire it up and try a query or two till you get something that works.
For example, I have a table Types, that includes an enum field Free. I
would get the possible values for Free like this:
SHOW COLUMNS FROM Types LIKE 'Free';
This returns:
+-------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------------+------+-----+---------+-------+
| Free | enum('No','Yes') | Yes | | Null | |
+-------+------------------+------+-----+---------+-------+
As you can see, the second column contains the vaules, and some extra
stuff. The trick is to parse the values out of the junk...
Once you get a query that returns the desired results in the MySQL
interpreter, you can convert it to PHP.
$Result =3D mysql_query( "SHOW COLUMNS FROM Types LIKE 'Free'" );
while( list( $Field, $Type, $Null, $Key, $Default, $Extra )
=3D mysql_fetch_row( $Result )) {
list( $junk, $Type ) =3D explode( '(', $Type );
# Type is now 'No','Yes')
list( $Type ) =3D explode( ')', $Type );
# Type is now 'No','Yes'
$Type =3D str_replace( "'", '', $Type );
# Type is now No,Yes
$Types =3D explode( ',', $Type );
# Types is now an array containing the values allowed for the enum.
# $Types[0] =3D No $Types[1] =3D 'Yes'
}
mysql_free_result( $Result );
This may not be the the easiest or best way to parse the data, but it
should work. I have not actually tried it...
Using a while may seem unusual when I already know there should only be one
row returned, but I use it because it will not throw an error message or
warning if no rows are returned.
Rick Widmer
Internet Marketing Specialists
www.developersdesk.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]