Reply to Re: mysql_real_escape_string() cannot connect to database..??

Your name:

Reply:


Posted by Kim Andrι Akerψ on 10/11/06 11:14

comp.lang.php wrote:

> when trying to use the mysql_real_escape_string() function, the
> following warning occurs:
>
> [quote]
> Warning: mysql_real_escape_string()
> [function.mysql-real-escape-string]: Access denied for user
> 'web'@'localhost' (using password: NO) in
> /home/me/web/include/secondary/app_action.inc.php on line 337
>
> Warning: mysql_real_escape_string()
> [function.mysql-real-escape-string]: A link to the server could not be
> established in /home/me/web/include/secondary/app_action.inc.php on
> line 337
> [/quote]
>
> First of all, the user is not 'web' trying to connect to the database,
> secondly, what is mysql_real_escape_string() doing connecting to the
> database, as 'web' or anyone else, and thirdly, why is this happening,
> does anyone know?
>
> Thanx
> Phil

Have you connected to your MySQL database yet?

From the manual:
-----------------------------
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(). If binary data is to be inserted, this function
must be used.
-----------------------------
Note: A MySQL connection is required before using
mysql_real_escape_string() otherwise an error of level E_WARNING is
generated, and FALSE is returned. If link_identifier isn't defined, the
last MySQL connection is used.
-----------------------------

--
Kim AndrΓ© AkerΓΈ
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)

[Back to original 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

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация