Steve wrote:
thank you for the clue of double quoting the html when inserting into the
database.... but I still get the error. the problem seems to be that I have
quotes INSIDE the html code as well (links and pix) so, i still get this
error.
"
Database Selected: candlecatalog
Query: insert into Products
(ProdID,ProdName,ProdType,ProdDesc,Price,Pic,Buy) Values ("VOALM","Almond
Votive","Votive","Our Almond scented Candles are melon
colored","1.25","","""<a href="HYPERLINK
"http://www.ccnow.com/cgi-local/cart.cgi?meltingpot_VOALM_http://www.themelt
ingpotonline.net/candleshop.html"><img"http://www.ccnow.com/cgi-local/cart.c
gi?meltingpot_VOALM_http://www.themeltingpotonline.net/candleshop.html";><img
src="HYPERLINK
"http://www.ccnow.com/images/buy_button_f.gif"http://www.ccnow.com/images/bu
y_button_f.gif" border="0" /> </a>""") Results
Error 1064: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'href="HYPERLINK
"http://www.ccnow.com/cgi-local/cart.cgi?meltingpot_VOALM_h"http://www.ccnow
.com/cgi-local/cart.cgi?meltingpot_VOALM_h
"

Your problem is not with MySQL but with the programming language you're using. It probably has a facility to do this.

PHP, as another poster has noted, has the function "mysql_real_escape_string()".

But you are not using PHP.

What language are you using? Do you have a manual for it? Does it have a section on interfacing with MySQL? On escaping quotes?

>
> the code i want to insert is:
>
> "<a href="HYPERLINK
> "http://www.ccnow.com/cgi-local/cart.cgi?meltingpot_VOALM_http://www.themelt > ingpotonline.net/candleshop.html"><img"http://www.ccnow.com/cgi-local/cart.c > gi?meltingpot_VOALM_http://www.themeltingpotonline.net/candleshop.html";><img
> src="HYPERLINK
> "http://www.ccnow.com/images/buy_button_f.gif"http://www.ccnow.com/images/bu
> y_button_f.gif" border="0" /> </a>"
>

Since you surround this with double quotes and then include more double quotes inside it, perhaps you are not a native speaker of a language that uses " for quotes. In the ASCII character set (and on most keyboards), the beginning quotation mark and ending quotation mark are identical. This makes for difficulties when trying to enclose quotation marks within the larger quote. You can use the single quote ' inside double quotes or you can escape the quotes (by preceding them with an escape character: the backslash character in the case of MySQL).

Hope that helps.

--J

PS Try to keep your messages in the same thread by replying to another message in that thread and not changing the subject.




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to