mysql_real_escape_string()

mysql_real_escape_string()

am 13.11.2007 03:22:46 von Ron Piggott

Last week the server my web site hosting company uses went down (along
with a bunch of other servers) My files have been moved to another
server the company uses. I am in the midst of configuring my site for
the new server.

Before the server went down I wasn't getting error messages. I know my
PHP code is ok. The new server is configured slightly differently. The
server is set up with the following:

Operating system Linux
Kernel version 2.4.21-47.0.1.ELsmp
Apache version 1.3.33 (Unix)
PHP version 4.3.10
MySQL version 4.1.22-standard

I am tweaking my site to make it work.

My actual question is this line of code:

$other = mysql_real_escape_string($other);

is giving me this error message:

Warning: mysql_real_escape_string(): Access denied for user
'nobody'@'localhost' (using password: NO) in /path/to/file/file.php on
line 148

Warning: mysql_real_escape_string(): A link to the server could not be
established in /path/to/file/file.php on line 148

I understand the error message and the request an open connection to the
database.

Where the previous server didn't require this I am wondering if there is
a line I may add to my .htaccess to by-pass this requirement. My
concern is that if I don't find all the instances I will have errors on
my site ... this is extensive to correct.

Suggestions?

Ron

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

Re: mysql_real_escape_string()

am 13.11.2007 05:20:05 von dmagick

> My actual question is this line of code:
>
> $other = mysql_real_escape_string($other);
>
> is giving me this error message:
>
> Warning: mysql_real_escape_string(): Access denied for user
> 'nobody'@'localhost' (using password: NO) in /path/to/file/file.php on
> line 148
>
> Warning: mysql_real_escape_string(): A link to the server could not be
> established in /path/to/file/file.php on line 148

You need to connect to the database before you can use
mysql_real_escape_string so it can work out database encoding etc.

> Where the previous server didn't require this I am wondering if there is
> a line I may add to my .htaccess to by-pass this requirement. My
> concern is that if I don't find all the instances I will have errors on
> my site ... this is extensive to correct.

You could try using auto_prepend_file (see
http://www.php.net/manual/en/ini.core.php).

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

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