[PHP] Escape Characters
Hi All, I'm running a script that reads the contents of images and stores them in a MySQL database. The problem I'm running into is that my server is seeing \ as escape characters and stripping them out. I assume this has something to do with Magic Quotes or something of that nature but I'm not exactly sure which variable I'm playing with. For the time being I'm replacing any \ with \\ so it only escapes one of them, but I'm sure this is not the correct solution. If anyone has any idea what I'm doing wrong any info would be greatly appreciated. I apologize if this has already been discussed but I could not find it in the archive. Maybe I was searching for the wrong thing? Please help. Thanks in advance, Brian Drexler -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Escape Characters
I'm running a script that reads the contents of images and stores them in a MySQL database. The problem I'm running into is that my server is seeing \ as escape characters and stripping them out. I assume this has something to do with Magic Quotes or something of that nature but I'm not exactly sure which variable I'm playing with. For the time being I'm replacing any \ with \\ so it only escapes one of them, but I'm sure this is not the correct solution. If anyone has any idea what I'm doing wrong any info would be greatly appreciated. I apologize if this has already been discussed but I could not find it in the archive. Maybe I was searching for the wrong thing? Please help. That's the correct solution. You can use addslashes() to do it for you. magic_quotes_gpc will do this automatically to data submitted through a form. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Escape characters won't go away
I'm getting multiple backslashes in data I get out of a mysql database. Example : ...Here\\\'s the d... No problem. Except I CANT GET RID OF THEM. I've tried several things: 1. $string = stripslashes($string); - Doesn't do anything 2. $string = ereg_replace(\\, , $string); - Doesn't do anything 3. $string = ereg_replace(\\, , $string); - Gives the following error message: Warning: REG_EESCAPE in script.php on line 1684 None of these have worked. Any thoughts on how to get rid of them? I'm going batty. Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Escape characters won't go away
on 02/09/02 1:14 PM, Mike Mannakee ([EMAIL PROTECTED]) wrote: I'm getting multiple backslashes in data I get out of a mysql database. Example : ...Here\\\'s the d... No problem. Except I CANT GET RID OF THEM. I've tried several things: 1. $string = stripslashes($string); - Doesn't do anything have you tried: $string = stripslashes(stripslashes($string)); // OR $string = stripslashes(stripslashes(stripslashes($string))); For multiple occurrences, you have to call it twice... or even three times. also try $string = str_replace(\', , $string); $string = str_replace(\\, , $string); Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Escape characters won't go away
Thanks. I just figured it out myself. I had to change the expression: $string= ereg_replace([\\]+, , $string); The above is what worked. Mike Justin French [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... on 02/09/02 1:14 PM, Mike Mannakee ([EMAIL PROTECTED]) wrote: I'm getting multiple backslashes in data I get out of a mysql database. Example : ...Here\\\'s the d... No problem. Except I CANT GET RID OF THEM. I've tried several things: 1. $string = stripslashes($string); - Doesn't do anything have you tried: $string = stripslashes(stripslashes($string)); // OR $string = stripslashes(stripslashes(stripslashes($string))); For multiple occurrences, you have to call it twice... or even three times. also try $string = str_replace(\', , $string); $string = str_replace(\\, , $string); Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] escape characters
In the following statement, can someone tell me what I would need to escape out if I were to put it all into a variable (I know the quotes, but that's all) : if (!$name){ $error_msg.=Your Name \n; } Thanks, Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] escape characters
what is a list of all the characters that have to be escaped? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] escape characters
nevermind, i found them -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]