Help for this page

Select Code to Download


  1. or download this
    $values = "'abc', 'dec'f', ''ghc''" ;
    $sql = "INSERT INTO SOME_TABLE ($columns) VALUES($values) ;
    
  2. or download this
    'abc' 'dec\'f' '\'ghc\''
    
  3. or download this
    $insert =~ s/(?<!^)'/\\'/g ; # gives: 'abc\' \'dec\'f\' \'...
    # and I tried:
    $insert =~ /s(?<!\s)'/\\'/g ; # gives \'abc\' 'dec\'f\'...
    
  4. or download this
    $insert =~ s/(?<!\s)'|(?<!^)'/\\'/g ; # wrong result :(
    $insert =~ s/(?<![^\s]/\\'/g ; # nope again