Results 1 to 9 of 9

Thread: Select '\';'

  1. #1
    Join Date
    May 2006
    Posts
    5

    Unanswered: Select '\';'

    Doing

    SELECT '\';'

    i get the following error message in query browser

    "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 ''\'' at line 1
    with ErrorNr 1064"

    i just can not see what is wrong

    any help would be appreciated

    /gobezu

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    don't do it that way, do it this way --
    Code:
    select ''''
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    May 2006
    Posts
    5
    thanks for your reply
    both
    mysql_real_escape_string("';") and
    mysql_escape_string("';")
    returns just \'; as the result
    that is why i am using it
    do you have any suggestion in the light of that?
    thanks again

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    in light of that, i have no idea, because i don't do php

    this is the mysql forum

    would you like me to move this thread to the php forum?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    May 2006
    Posts
    5
    ok, that might be a better move then
    but i have no clue how to do that?

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    what is it you are trying to accomplish?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  7. #7
    Join Date
    May 2006
    Posts
    5

    performance by caching generated content

    well i promise you this is not a theoretical quiz for me
    i am developing a component where i am doing a lot of caching of the generated content into db and some of the contents contain javascript code like
    Code:

    onClick="javascript:{initComparisonAll('all'); return true;}"

    which is a snippet of a much larger data to be saved
    so there is really a need for me to shove this thing down to mysql and get it back in some deterministic fashion which does not counter the very aim of my caching, namely performance
    so please help me

  8. #8
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by gobezu
    so please help me
    who, me? i can't, i don't do php

    how is this different from storing the name O'Toole in the database?

    unless there's a spiffy php function (and there probably is), you can simply replace each single quote with two in a row
    Code:
    insert into persons (lastname) values ( 'O''Toole' )
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  9. #9
    Join Date
    May 2006
    Posts
    5
    ok, thanks so far anyway
    but the thing is that i use an escaping function which does very well except this one
    i have cross posted my issue in other forums so let us see what pops up elsewhere
    once again thanks so far

Posting Permissions

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