Grokbase Groups MySQL mysql May 2006
FAQ
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
"

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>"


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.6.0/342 - Release Date: 5/17/2006

Search Discussions

  • Chris W at May 18, 2006 at 10:34 pm

    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.
    PHP has a function called 'mysql_real_escape_string' this function will
    add the needed escape characters to allow the insert to work. The APIs
    for other languages should all have the same function. *
    *

    --
    Chris W
    KE5GIX

    Gift Giving Made Easy
    Get the gifts you want &
    give the gifts they want
    One stop wish list for any gift,
    from anywhere, for any occasion!
    http://thewishzone.com
  • Steve at May 18, 2006 at 11:05 pm
    I'm a very beginner and trying to get my way into sql with...
    One told me to double quote the html. Now, it's said the php has a
    "mysql_real_escape_string" so... What the hell is this and how do I make
    that work??? And where is the radio to call MAYDAY???? Or SOS???


    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.
    PHP has a function called 'mysql_real_escape_string' this function will
    add the needed escape characters to allow the insert to work. The APIs
    for other languages should all have the same function. *
    *

    --
    Chris W
    KE5GIX

    Gift Giving Made Easy
    Get the gifts you want &
    give the gifts they want
    One stop wish list for any gift,
    from anywhere, for any occasion!
    http://thewishzone.com


    --
    MySQL General Mailing List
    For list archives: http://lists.mysql.com/mysql
    To unsubscribe:
    http://lists.mysql.com/mysql?unsub=steve_friedman71@mchsi.com

    --
    No virus found in this outgoing message.
    Checked by AVG Free Edition.
    Version: 7.1.392 / Virus Database: 268.6.0/342 - Release Date: 5/17/2006
  • John Hicks at May 19, 2006 at 12:31 am

    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.
  • Logan, David (SST - Adelaide) at May 19, 2006 at 1:00 am
    There is no reason why you can't use single quotes around the HTML. You
    don't appear to have any single quotes with the HTML so this should work
    fine. Everything, including the double quotes, should be then stored in
    your database.

    Regards


    ---------------------------------------------------------------
    ********** _/ ********** David Logan
    ******* _/ ******* ITO Delivery Specialist - Database
    ***** _/ ***** Hewlett-Packard Australia Ltd
    **** _/_/_/ _/_/_/ **** E-Mail: david.logan@hp.com
    **** _/ _/ _/ _/ **** Desk: +618 8408 4273
    **** _/ _/ _/_/_/ **** Mobile: 0417 268 665
    ***** _/ ******
    ****** _/ ******** Postal: 148 Frome Street,
    ******** _/ ********** Adelaide SA 5001
    Australia
    i n v e n t
    ---------------------------------------------------------------

    -----Original Message-----
    From: John Hicks
    Sent: Friday, 19 May 2006 10:03 AM
    To: Steve
    Cc: smaugzone@gmail.com; mysql@lists.mysql.com
    Subject: Re: than you for your answer but...

    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.the
    melt
    >
    ingpotonline.net/candleshop.html"><img"http://www.ccnow.com/cgi-local/ca
    rt.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/image
    s/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.c
    cnow
    .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.the
    melt
    >
    ingpotonline.net/candleshop.html"><img"http://www.ccnow.com/cgi-local/ca
    rt.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/image
    s/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/mysql?unsub=david.logan@hp.com

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmysql @
categoriesmysql
postedMay 18, '06 at 9:49p
activeMay 19, '06 at 1:00a
posts5
users4
websitemysql.com
irc#mysql

People

Translate

site design / logo © 2021 Grokbase