RE: [PHP] Newbie problem - Slashes
Show us your code. ---John Holmes... > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Thursday, June 27, 2002 5:33 PM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; > [EMAIL PROTECTED] > Subject: Re: [PHP] Newbie problem - Slashes > > > Hi John,Phillip, > Thanks for writing. > > > You're fault. :) > Guessed as much. :-) > > I know quotes are used for the beginning and end of a string,but i'm > thinking what if a user "accidently" puts in a double quote.maybe as a > typo error? > > The part I cannot understand is why is the MySql database's cutting off > everything after the escapeing \.? > eg: > When i enter: My pal is Lisa O"neil > and escape it with: (via addslashes) > My pal is Lisa O\"neil > in the database all thats entered is: > My pal is Lisa O\ > > Why is that? > > Please help, > -Kim. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie problem - Slashes
Hi, Maybe mysql_escape_string($string) helps? Greetings, Nookie - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, June 27, 2002 11:32 PM Subject: Re: [PHP] Newbie problem - Slashes > > Hi John,Phillip, > Thanks for writing. > > > You're fault. :) > Guessed as much. :-) > > I know quotes are used for the beginning and end of a string,but i'm thinking what if a user "accidently" puts in a double quote.maybe as a typo error? > > The part I cannot understand is why is the MySql database's cutting off everything after the escapeing \.? > eg: > When i enter: My pal is Lisa O"neil > and escape it with: (via addslashes) > My pal is Lisa O\"neil > in the database all thats entered is: > My pal is Lisa O\ > > Why is that? > > Please help, > -Kim. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie problem - Slashes
Hi John,Phillip, Thanks for writing. > You're fault. :) Guessed as much. :-) I know quotes are used for the beginning and end of a string,but i'm thinking what if a user "accidently" puts in a double quote.maybe as a typo error? The part I cannot understand is why is the MySql database's cutting off everything after the escapeing \.? eg: When i enter: My pal is Lisa O"neil and escape it with: (via addslashes) My pal is Lisa O\"neil in the database all thats entered is: My pal is Lisa O\ Why is that? Please help, -Kim. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie problem - Slashes
You're fault. :) Remember that quotes are used to tell the beginning and end of a string. So if you are using a " to mean the beginning of the string, then there can't be any " within the string itself. If there are any ", they need to be changed to \", which means they are escaped. magic_quotes_gpc = ON does this automatically for you when you submit values through GET, POST, or COOKIE. You can also use the addslashes() function. Your errors are all related to this issue. ---John Holmes... - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 27, 2002 4:59 PM Subject: [PHP] Newbie problem - Slashes > > Hello all, > I'm a newbie into PHP and am facing a funny problem. > > I have a form with a textarea named address, > I am able to submit the form and enter the data into the database without any problem,but to make sure that it handles "bad" data too I tested it out with this sentance: > > When cheese gets it's picture taken, what does it say? > > then "previewed" it and the output was, (note the slash ) > > When cheese gets it\'s picture taken, what does it say? > > (even entered into the database without a problem) > > so I further tested it with: (note the " instead of the ') > > When cheese gets it"s picture taken, what does it say? > > and the output was: > When cheese gets it\"s picture taken, what does it say? > > but when I looked in the database it only showed > When cheese gets it\ > > any idea what the problem is? is it my fault or PHP's or MySql's? > > sorry if its a bit confusing, if need be I can send you all the 3 files i'm using and the table structure, kindly help. > > - Kim. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie problem - Slashes
Hello all, I'm a newbie into PHP and am facing a funny problem. I have a form with a textarea named address, I am able to submit the form and enter the data into the database without any problem,but to make sure that it handles "bad" data too I tested it out with this sentance: When cheese gets it's picture taken, what does it say? then "previewed" it and the output was, (note the slash ) When cheese gets it\'s picture taken, what does it say? (even entered into the database without a problem) so I further tested it with: (note the " instead of the ') When cheese gets it"s picture taken, what does it say? and the output was: When cheese gets it\"s picture taken, what does it say? but when I looked in the database it only showed When cheese gets it\ any idea what the problem is? is it my fault or PHP's or MySql's? sorry if its a bit confusing, if need be I can send you all the 3 files i'm using and the table structure, kindly help. - Kim. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php