|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Re: (newbie) Problems INSERT'ing field type "SET"
From: Chris (listschris
leftbrained.org)
Date: Wed Feb 09 2005 - 20:31:53 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Your problem seems to be one of spaces.
This query tries to set the SET to TWO values, "family" and " money"
(notice the space before money"
INSERT into my_table (name, subjects) VALUES ("Joyce", "family, money")
Try it without the space:
INSERT into my_table (name, subjects) VALUES ("Joyce", "family,money")
Chris
J Wermont wrote:
>Hi,
>
>I'm new to MySQL and at this point, I'm just trying to insert rows
>of data into a table.
>
>When I insert a row of data that includes a field of type "set"
>(corresponding to an HTML set of checkbox answers), only the first
>item in the list gets inserted into the row.
>
>For example, I have a table where one column, called "subject", is
>of type "set". During one INSERT, the field "subject" corresponded
>to the values "family, money". After I did the INSERT, the only thing
>that showed up in the "subjects" field was "family". If I did it again
>with a different list as values (eg, "jobs, school, parents"), only
>"jobs" would show up in the table.
>
>Here's the syntax:
>
>INSERT into my_table (name, subjects) VALUES ("Joyce", "family, money")
>
>Or, using a command line interface:
>
>mysql> insert
> -> into my_table
> -> (name, subjects)
> -> VALUES
> -> ("Joyce", "family, money")
> -> ;
>
>The insert goes fine, but in the subjects column, only "family" is in
>the field.
>
>Everything else in the row gets into the table with no problems. And
>there is no error message - as far as the MySQL server is concerned,
>everything went fine.
>
>I've looked at different doc sites about MySQL to see if you have to
>format set data differently from other field types during INSERT, but
>have found nothing.
>
>Any suggestions??
>
>Thanks,
>J. Wermont
>
>
>
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]