Hi, Jon.

>With mysql, you need to watch out for illegal characters. That means if
>value1 = "This won't work" you need to replace it with "This won\'t work"

Will I have to run some code to parse the strings to find illegal characters
and insert a "\" before them?

Will using CFPARAM (as Craig suggested in another response to this thread)
and redefining the form.variables (which is where the strings to insert will
come from)
take care of the illegal character problem?

Thanks for your help...

Rick

-----Original Message-----
From: jon roig [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 16, 2002 11:08 AM
To: CF-Talk
Subject: RE: mySQL & CF


For mysql -- or any sql, really -- you code it as follows:

<cfquery name="yourName" datasource="yourDataSource">
INSERT INTO yourTable (field1, field2) VALUES ('value1', 'value2')
</cfquery>

With mysql, you need to watch out for illegal characters. That means if
value1 = "This won't work" you need to replace it with "This won\'t work"

In other words, you need to escape the quotes.

Good luck and enjoy mysql. For what it is -- a quick, simple little db --
it's really quite nice.

        -- jon

-------------
jon roig
senior manager, online production
epilepsy foundation
phone: 215.850.0710
site:  http://www.epilepsyfoundation.org
email: [EMAIL PROTECTED]


-----Original Message-----
From: Rick Faircloth [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 16, 2002 11:02 AM
To: CF-Talk
Subject: RE: mySQL & CF


Hi, Matt.

I, too, learned about the CFUPDATE problem from personal experience
and from the Allaire forums when I first started using CF (with Access at
that time).
I stopped using it and went to the CFQUERY...Set... approach.  That's worked
fine.

I haven't had any problems with CFINSERT, but if that may be problematic in
the future
I may as well go ahead and change my coding habits now.

How is the INSERT coded for mySQL and CF?
Example?

Thanks,

Rick


-----Original Message-----
From: Matt Robertson [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 16, 2002 1:11 AM
To: CF-Talk
Subject: RE: mySQL & CF


Rick,

I noticed you mention that you use CFINSERT.  From your earlier postings I
know you are on CF 4.5x, as I am.

You're likely to discover that CFINSERT and/or CFUPDATE sometimes blow
sky-high on CF 4.5x (at least) when working with mySQL (3.23 for sure, and
maybe 4.0x).  In threads on the subject over at the (then) Allaire forums no
specific cause was ever traced.  It just happens.  Sometimes.

In one of those threads I believe it was Paul Hastings who advised me to
'just say no to cfinsert/cfupdate' and it ranks as some of the best CF
advice I ever got.  On the surface those tags appear to be handy shortcuts,
but they black-box your SQL, take away the otherwise granular control you
should have and make debugging ... difficult.

I suggest you follow the same advice -- you'll probably find out you have
to, anyway.  While you're at it go for the double bonus and implement
cfqueryparam.

Happy Monday (early) :)

---------------------------------------
Matt Robertson, MSB Designs, Inc.
http://mysecretbase.com - Retail
http://foohbar.org - ColdFusion Tools
---------------------------------------





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

Reply via email to