Re: Should I use mysql, mysqli or PDO?
- From: NoDude <nodude@xxxxxxxxx>
- Date: Tue, 06 Nov 2007 01:25:08 -0800
On Nov 6, 6:37 am, AnrDaemon <anrdae...@xxxxxxxxxxx> wrote:
Greetings, Rik Wasmus.
In reply to Your message dated Monday, November 5, 2007, 11:42:54,
PHP doesn't know everything about the MySQL server, so escaping string can
be tricky business (especially with 'broken' Unicode, there's a very slim
possibility a quote will appear where there was none). Prepared statements
free you from that headache.
Sorry, but... what mysql_real_escape_string function does then?
--
Sincerely Yours, AnrDaemon <anrdae...@xxxxxxxxxxx>
the *_real_escape_string family get the encoding they're supposed to
escape from mysql while connecting, if you happen to set mysql to
another encoding (and in some edge cases just in php) you might not
get the string you expected in mysql. That's what Wasmus was talking
about, when he mentioned there's a chance of a quote appearing where
you didn't expect it.
A user might put a character that's supposed to be a in cp1251, but
is a ' in some Uganda encoding. You happen to be in uganda and you
happen to not use true UTF, so you do some encoding switching. Worst
case scenario - maybe a table will be dropped. Hackers on the other
hand try huge amounts of possible sql injections. If there's a weak
spot, they're bound to find it sooner or later.
If you're keen on using the mysql extension, make suer everything you
do is true unicode, but there's still the chance you happen to forget
to escape something, somewhere, somethime.
.
- Follow-Ups:
- Re: Should I use mysql, mysqli or PDO?
- From: AnrDaemon
- Re: Should I use mysql, mysqli or PDO?
- References:
- Should I use mysql, mysqli or PDO?
- From: macca
- Re: Should I use mysql, mysqli or PDO?
- From: Jerry Stuckle
- Re: Should I use mysql, mysqli or PDO?
- From: james
- Re: Should I use mysql, mysqli or PDO?
- From: Rik Wasmus
- Re: Should I use mysql, mysqli or PDO?
- From: AnrDaemon
- Should I use mysql, mysqli or PDO?
- Prev by Date: Re: Display previous month
- Next by Date: Running php file as a background process
- Previous by thread: Re: Should I use mysql, mysqli or PDO?
- Next by thread: Re: Should I use mysql, mysqli or PDO?
- Index(es):
Relevant Pages
|