Re: Fixed Quote Marks in Inputs

From: Date: Fri, 04 Jan 2002 22:38:52 +0000
Subject: Re: Fixed Quote Marks in Inputs
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-15418@lists.php.net to get a copy of this message
Oh, one more thing - maybe you don't understand what the slashing is for: you don't store \" in the database -- the slash is there just so the MySQL statement is correct. MySQL knows about slashing and will replace your \" with " so what you store in the database is exactly what the user typed in the input box. Bogdan Jonathan Hilgeman wrote: > How is it the \"proper\" way to do it and why does it have to remain the > \"proper\" way of doing it? Simply because it retains the same character in > the database? What good is that if the data will simply be extracted and > unslashed at a later point anyway? > > How the data is kept internally should not be an issue if it is only stored > to be later extracted and parsed anyway. That's a partial reason we use > timestamps instead of storing the full date everywhere. It's called proper > representation. > > And I think in cases where HTML forms are used in conjunction with > databases, the HTML equivalents are a heck of a lot more proper than > slashes, not to mention more efficient. The only downside I see is that > instead of taking up 2 characters, it takes up 6, but since many fields we > all use won't ever contain quotes, I see it as a more than reasonable > trade-off. > > I personally consider it a bad habit to use slashes unless you're dealing > with regexes. And not everybody does it that way. > > - Jonathan > > -----Original Message----- > From: Bogdan Stancescu [mailto:mgv@fx.ro] > Sent: Friday, January 04, 2002 1:41 PM > To: Jonathan Hilgeman > Cc: 'php-db@lists.php.net' > Subject: Re: [PHP-DB] Fixed Quote Marks in Inputs > > That would be because this way you'll end up with the proper data in the > database instead of HTML-encoded strings. Plus it's the proper way to do it > -- > everybody does it this way and it's a good habit. > > Bogdan > > Jonathan Hilgeman wrote: > > > I thought I made it somewhat clear: > > > when I'm dealing with form inputs that can contain quote marks > > > > Why run 3 functions at separate times when you can run one once just > before > > data is inserted into the database? > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#15418) next »