SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Malaysia
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    adding in SQL text with apostrophes

    hey guys...

    slight dilemma.

    I'm using mySQL and am inserting / updating stuff into a table like this:

    PHP Code:
    update pdc_emp
    SET text
    ='infinitium is a cool guy' WHERE ID=10662105
    Ok... now how do I modify it so SQL will recognize the text "'infinitium's a cool guy", with the apostrophe?

    this is just an example.. don't mind the actual inserted text....

  2. #2
    SitePoint Evangelist
    Join Date
    Jul 2001
    Location
    UK
    Posts
    407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Backspace before the apostrophe?

    Like:

    PHP Code:
    SET text='infinitium[b]\[/b]'s a cool guy' WHERE ID=10662105; 

  3. #3
    SitePoint Zealot alexk's Avatar
    Join Date
    Nov 2000
    Location
    Sydney, Australia
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you should use backslashes:

    SET text='infinitium\'s a fn\' cool guy' WHERE ID=10662105;

    Last edited by alexk; Aug 21, 2001 at 06:15.

  4. #4
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Malaysia
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just what i was looking for.. thanks!


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
  •