You are here: Re: mysql_real_escape_string() « PHP Programming Language « IT news, forums, messages
Re: mysql_real_escape_string()

Posted by zach on 08/05/07 20:39

Rik wrote:
> On Sun, 05 Aug 2007 21:46:59 +0200, zach <wackzingo@gmail.com> wrote:
>
>> Paul Lautman wrote:
>>> zach wrote:
>>>> The manual only said it needed an open connection, but didn't
>>>> explain,(or not very clearly) why it needed it.
>>> But Matt quoted from the manual the text:
>>> "This is needed because the escaping depends on the character set in
>>> use by the server."
>>> This is in the first paragraph of the section in the manual.
>>
>> I read the PHP manual and it said nothing about this, it only
>> mentioned that in the mysql manual.I am writing a PHP script and so I
>> looked in the PHP manual. Who would have thought that writing a script
>> in PHP, people would expect you to look to other manuals for information.
>
> Euhm:
> <http://www.php.net/mysql_real_escape_string>
>
> [quote]
> ...
> Escapes special characters in the unescaped_string, taking into account
> the current character set of the connection so that it is safe to place
> it in a mysql_query().
> ...
> link_identifier
>
> The MySQL connection. If the link identifier is not specified, the last
> link opened by mysql_connect() is assumed. If no such link is found, it
> will try to create one as if mysql_connect() was called with no
> arguments. If by chance no connection is found or established, an
> E_WARNING level warning is generated.
> [/quote]
>
> Well, it's all there, the character set, the connection, the opening of
> an anonymous one... I knew it and I have never read the portion in the
> MySQL manual that mentions the use of mysql_real_escape_string.
>
> I guess reading is an art.
> --Rik Wasmus

I read that. That's how I fixed the connection error. I didn't supply a
link identifier or have an open connection to that point in the script.
I just didn't know why it needed the connection. And this, "taking into
account the current character set of the connection", as someone who is
very new that makes no sense. I had no idea what that meant. Which is
why I asked here. Less than 1 month ago I didn't know how to do much
more than echo something to the screen.

Yes, reading is an art if you know what it is you're looking for.

Zach

 

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

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