RE: [PHP-DB] Fixed Quote Marks in Inputs
| From: | Jonathan Hilgeman | Date: | Fri, 04 Jan 2002 22:03:54 +0000 |
| Subject: | RE: [PHP-DB] Fixed Quote Marks in Inputs | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-15416@lists.php.net to get a copy of this message | ||
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?