On Thu, 3 Jul 2003 11:20:56 +0200 anthony <[EMAIL PROTECTED]> wrote:

> i have many text like this
> column1="great,null,nothing"
> etc....
> how would I insert text with commas as above in columns.
> 
> Should i do.
> Insert into table values($text1,$text2,$text3)
> ##where text1,text2, text3 has the same format as
> ###"great,null,nothing"

It would be a good idea to list the columns you are inserting into to
avoid problems if you add or reorder columns in the table.

If "great", NULL, and "nothing" are to be the values for text1, text2,
and text3 respectively, you will need to split the list of values
before applying them.  NULL is a special case which should not be
quoted or should be changed to undef if it is being applied to a
placeholder.

> 
> How about updating?
> Update table1 SET column=$text1, column2= $text2 ... WHERE id = $id

Please read the fine DBI manual:

   perldoc DBI
   http://search.cpan.org/dist/DBI/DBI.pm

The section on placeholders may be particularly interesting.  If they
don't work in your DBD driver, look at the quote() method.

-- 
Mac :})
** I usually forward private questions to the appropriate mail list. **
Ask Smarter: http://www.catb.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.

Reply via email to