[PHP] apostrphe's entered into MySQL database

2002-02-27 Thread Tim Thorburn
Hi, I've sent a few emails thus far regarding adding apostrophe's through a PHP script form into a MySQL database. The responses I received indicated to me that I needed to get my hosting company to activate magic_quotes_gpc. After several days of talking with what seems to be the sole tech

Re: [PHP] apostrphe's entered into MySQL database

2002-02-27 Thread Julio Nobrega Trabalhando
Why isn't addslashes() working? You addslashes then you stripslashes() :-) Anyway, how about mysql_escape_string()? -- Julio Nobrega. Um dia eu chego lá: http://sourceforge.net/projects/toca Ajudei? Salvei? Que tal um presentinho?

Re: [PHP] apostrphe's entered into MySQL database

2002-02-27 Thread Matt Drake
I don't see why addslashes wouldn't work, but why not roll your own? $dbStr = preg_replace(/'/, /\\'/); I believe that, in MySQL, you can also double-up single quotes to escape them: $dbStr = preg_replace(/'/, /''/); HTH Matt On Wed, 27 Feb 2002, Tim Thorburn wrote: Hi, I've sent a few

Re: [PHP] apostrphe's entered into MySQL database

2002-02-27 Thread Matt Drake
Whoops...helps if I write it legally. $dbStr = preg_replace(/'/, /\\'/, $dbStr); $dbStr = preg_replace(/'/, /''/, $dbStr); M On Wed, 27 Feb 2002, Matt Drake wrote: I don't see why addslashes wouldn't work, but why not roll your own? $dbStr = preg_replace(/'/, /\\'/); I believe that, in