SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast xnszxdotnet's Avatar
    Join Date
    Oct 2004
    Location
    Ohio
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ASCII codes for HTML

    I'm trying to create a dump file for my homebrewed database(mySQL)

    I'm trying to use a quot marks for a large amount of text. mysql doesn't like the quot at the end of the ACSII codes for quot mark.
    (ie
    &34;
    or
    &quot

    how do I work around this?

    Thanx
    Code:
    (ie
    Code:
    (ie
    &34;
    or
    ")

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    do you mean the curly quotes, and (single), and (double)?

    ‘ and ’ for single

    “ and ” for double,
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Enthusiast xnszxdotnet's Avatar
    Join Date
    Oct 2004
    Location
    Ohio
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    " some text here "

    More text here

    "more quots here"

    sql doesn't like the semi colon at the end of the ASCII codes for quots??

    sorry I wasn't to clear the first posting.


  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    in sql, the only character that is treated any differently from all the others is the one used to delimit the string

    a semicolon inside a properly delimited string is just another character
    Code:
    create table testquotes
    ( id tinyint not null primary key auto_increment
    , foo varchar(99)
    );
    insert into testquotes(foo) values
     ('my name is o''toole')
    ,('"stop," i said; "that''s enough."')
    ;
    select * from testquotes
    ;
    the above produces:

    id foo
    1 my name is o'toole
    2 "stop," i said; "that's enough."
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Enthusiast xnszxdotnet's Avatar
    Join Date
    Oct 2004
    Location
    Ohio
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanx
    I didn't know about the ( )

    Code:
    insert into testquotes(foo) values
     ('my name is o''toole'
    ,'"stop," i said; "that''s enough."')
    ;

  6. #6
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    you changed my INSERT statement, it will no longer work with my table
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •