You are here: Re: 2 small Q's about mysql_real_escape_string() « PHP Programming Language « IT news, forums, messages
Re: 2 small Q's about mysql_real_escape_string()

Posted by Andy Hassall on 11/07/02 11:31

On 7 Nov 2005 06:53:32 -0800, "frizzle" <phpfrizzle@gmail.com> wrote:

>I have 2 small questions, which i really want to be sure about:
>
>- does mysql_real_escape_string() prevent any kind of mysq-injection?

If you always remember to use it correctly, then it stops the class of SQL
injection attacks where values are interpreted as SQL.

>- can it put escaped quotes etc in the DB, or are those automatically
> 'converted' again?

Well, that's one of its more common uses, to escape quotes in quoted strings
properly. Nothing's automatically converted, unless you have the dreaded
magic_quotes option turned on. So not sure what you're asking there.

I still maintain you're better off using a library such as ADOdb which
emulates placeholders for MySQL - not only do you not have to worry about
escaping any more, it also gets you into better habits for other databases
where using placeholders/bind variables is critical for efficiency.

http://adodb.sourceforge.net/
http://phplens.com/adodb/reference.functions.prepare.html
--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация