Re: Using mysql_real_escape_string without connecting to mysql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dotan Cohen wrote:
I have a file of my own functions that I include in many places. One
of them uses mysql_real_escape_string, however, it may be called in a
context that will or will not connect to a mysql server, and worse,
may already be connected. So I must avoid connecting. However, when I
run the script without connecting I get this error:

Warning: mysql_real_escape_string()
[function.mysql-real-escape-string]: Access denied for user:
'nobody@localhost' (Using password: NO)

I was thinking about checking if there is a connection, and if not
then connecting. This seems redundant to me, however. What is the
list's opinion of this situation? Thanks in advance.

real_escape_string needs a connection so it knows what encoding and charset the database supports.

No way around it sorry :)

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux