Percy,

I would highly recommend using <cfqueryparam> with MySQL / CFMX.  It would 
look like:

<cfquery name="q_savebk" datasource="home">
insert into web.bookmark(ulocation, desc)
values(<cfqueryparam cfsqltype="cf_sql_varchar" 
value="#form.f_ulocation#">,
           <cfqueryparam cfsqltype="cf_sql_varchar" 
value="#form.f_desc#">)
</cfquery>

Reason why?  Because escapes all the special characters for you, etc.  You 
don't need to worry about URLEncoding.

~Todd


On Tue, 12 Nov 2002, Perez, Percy wrote:

> Hello everyone,
> I am trying to issue a simple insert statement and it is giving me an error.
> 
> The SQL statement is:
> 
> <cfquery name="q_savebk" datasource="home">
> insert into web.bookmark(ulocation, desc) 
> values ('#URLEncodedFormat(form.f_ulocation)#','#form.f_desc#')
> </cfquery>
> 
> Value of form.f_ulocation is : http://www.macromedia.com
> Value of form.f_desc is : Macromedia website
> 
> The platform is: Linux Redhat 7.3/MX Pro/MySQL
> 
> Below is the error message from the Server (BTW, I tried the above in my NT
> server and it works.).
> Thank you in advance,
> 
> Percy
> 
> ---
> 
> Error Executing Database Query.  
> Syntax error or access violation: You have an error in your SQL syntax near
> 'desc) values ('http%3A%2F%2Fwww%2Emacromedia%2Ecom%2F','Macromedia
> Website')' at line 1  
>   
> The error occurred in /home/www/developer/bookmarks/test_save.cfm: line 14
>  
> 12 : values 
> 13 : ('#URLEncodedFormat(form.f_ulocation)#','#form.f_desc#')
> 14 : </cfquery>
> 
> 
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
Get the mailserver that powers this list at http://www.coolfusion.com

Reply via email to