Re: RE: Re: [PHP-DB] mysql's enum type used with php/html form?
| From: | Maxwell Hung | Date: | Wed, 24 May 2000 21:45:45 +0000 |
| Subject: | Re: RE: Re: [PHP-DB] mysql's enum type used with php/html form? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-485@lists.php.net to get a copy of this message | ||
As long as the options are valid they should be
inserted the same as any other field type.
if you're pulling the enums into a select menu, the
option selected should go straight back into the
database.
Although if my memory serves me correct you were
talking about the user selecting more than one option,
in which case an enum field would not serve this
purpose, as far as I am aware it will only accept one
option.
If you want them to be able to use more than this
maybe you should try putting there chosen options into
an array and implode them into the db, then explode
them on the way back out.
Obviously an enum column would not serve this purpose.
Hope this helps
M@x
--- Kenn Murrah <warden@bakergrfx.com> wrote: > You're
exactly right -- I was not clear in my first
> message....
> My difficulty is in inserting or updating the
> record, not in
> viewing it.... I have the field defined as enum in
> mySQL and
> I need to insert it ... I have the HTML code written
> so that
> the pulldown list works properly, but I have not
> been able to
> get the selection to insert into the database.
>
> Any ideas? Or better yet, could anyone simply point
> me to
> a code sample?
>
> Thanks to everyone.
>
> Kenn
>
> ----- Original Message -----
> From: <M.vanderMerwe@expro.shell.co.uk>
> To: <php-general@lists.php.net>
> Sent: Wednesday, May 24, 2000 8:38 AM
> Subject: [PHP-GENERAL] RE: Re: [PHP-DB] mysql's enum
> type used with php/html
> form?
>
>
> > I don't think he had the same question. He's
> question was more about
> > once you have the value in the enum dropdown, how
> to update or insert
> > the record in the particular table he wants to
> update.
> >
> > In any case, the answer to my question seems to
> have been answered the
> > easiest by this answer:
> >
> > From: maxwell.hung [maxwell_hung@yahoo.com]
> >
> > $result = mysql_query("SHOW COLUMNS FROM main LIKE
> 'subject'");
> >
> > while ($answer = mysql_fetch_array($result))
> > {
> > // Grab everything between the first
> > // and last single quote, exclusive
> > ereg( "('(.*)')", $answer[1], $temp );
> > // Explode on the inner " ',' " combination
> > $array = explode( "','", $temp[2] );
> >
> > while (list ($key, $val) = each ($array))
> > {
> > echo "<option value=\"$val\">$val</option>\n";
> > }
> > }
> >
> >
> >
> > Thanks again for everyone who answered this
> question. i tried all, but
> > this seemed to do the trick easiest.
> >
> > Thys
> >
> >
>
>
>
----------------------------------------------------------------------------
> ----
>
>
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail:
> php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail:
> php-general-help@lists.php.net
> > To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-general-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-general-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/