473,789 Members | 2,740 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mysql_real_esca pe_string() cannot connect to database..??

when trying to use the mysql_real_esca pe_string() function, the
following warning occurs:

Warning: mysql_real_esca pe_string()
[function.mysql-real-escape-string]: Access denied for user
'web'@'localhos t' (using password: NO) in
/home/me/web/include/secondary/app_action.inc. php on line 337

Warning: mysql_real_esca pe_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
First of all, the user is not 'web' trying to connect to the database,
secondly, what is mysql_real_esca pe_string() doing connecting to the
database, as 'web' or anyone else, and thirdly, why is this happening,
does anyone know?

Thanx
Phil

Oct 11 '06 #1
2 29548
comp.lang.php wrote:
when trying to use the mysql_real_esca pe_string() function, the
following warning occurs:

Warning: mysql_real_esca pe_string()
[function.mysql-real-escape-string]: Access denied for user
'web'@'localhos t' (using password: NO) in
/home/me/web/include/secondary/app_action.inc. php on line 337

Warning: mysql_real_esca pe_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

First of all, the user is not 'web' trying to connect to the database,
secondly, what is mysql_real_esca pe_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_strin g, 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_esca pe_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ĝ
- ki******@NOSPAM betadome.com
(remove NOSPAM to contact me directly)
Oct 11 '06 #2

"comp.lang. php" <ph************ **@gmail.comwro te in message
news:11******** *************@k 70g2000cwa.goog legroups.com...
when trying to use the mysql_real_esca pe_string() function, the
following warning occurs:

Warning: mysql_real_esca pe_string()
[function.mysql-real-escape-string]: Access denied for user
'web'@'localhos t' (using password: NO) in
/home/me/web/include/secondary/app_action.inc. php on line 337

Warning: mysql_real_esca pe_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

First of all, the user is not 'web' trying to connect to the database,
secondly, what is mysql_real_esca pe_string() doing connecting to the
database, as 'web' or anyone else, and thirdly, why is this happening,
does anyone know?

Thanx
Phil
if you are on an apache system then PHP is likely running as other (out of
user/group/other) and as a result may well be seen as 'web'

you don't give any context other than a line number for the error so it
makes it a litle harder to intuit what might be happening.

you could change the error reporting to notice to see extra warnings

A MySQL connection is required before using mysql_real_esca pe_string()
otherwise an error of level E_WARNING is generated...
so it may be that you don't have a valid mysql connection but without seeing
the context who knows?

here's what happens on my local server when I call that without a db link:

<?php echo mysql_real_esca pe_string("some text"); ?>

Warning: mysql_real_esca pe_string() [function.mysql-real-escape-string]:
Access denied for user: 'ODBC@localhost ' (Using password: NO) in i:\program
files\apache group\apache\ht docs\mres.php on line 1

but on my remote server the same thing gives:
Warning: mysql_real_esca pe_string(): Access denied for user:
'nobody@localho st' (Using password: NO)in
/home/user/public_html/sitename/mres.php on line 1

so as you can see the user that appears in the error depends on how your
sever is configured.
Oct 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
7640
by: Marcus | last post by:
Hello, My php.ini file currently has magic quotes set to On, but I have read that it is better to code with it off. Currently with magic quotes on, I only use stripslashes() to properly format strings that are displayed on the screen. I know that now with magic quotes off, I will have to manually handle escaping special characters with mysql_real_escape_string() or addslashes().
4
3124
by: JM Ivler | last post by:
Is there really any time when I don't want to run every _POST and _GET through mysql_real_escape_string() before I use that data in accessing the database? In other words, is there a good reason why I shouldn't have a function that walks through the POST and GET arrays and processes the mysql_real_escape_string() function against the data in order to ensure that there will be no attempts to do an SQL inject? My thinking is that this...
2
2915
by: matthud | last post by:
<?php //MAKE IT SAFE $chunk = $_POST; $title = $_POST; $url = $_POST; $tags = $_POST; $user = $_POST; $safe_chunk = mysql_real_escape_string(htmlentities($chunk)); $safe_title = mysql_real_escape_string(htmlentities($title));
5
2403
by: vivek | last post by:
Could someone please help me figure out why the memory usage fluctuates when I use mysql_real_escape_string? I'm finding (what I think are) memory leaks with a few mysql functions in php and I'm trying to figure them all out. This one is pretty vexing. Thanks in advance. Here is example code: class memTest { function __construct() { $con = mysql_connect("***************","*******","****");
11
2747
by: zach | last post by:
I created a comment form which will inserts the comments into a database and displays them immediately. I want to make sure that its safe from users inserting unwanted data into the database or executing queries. Here's my php code, is this done right? Is there anything else I should to to make it more secure? $handle = mysql_connect($host,$user,$password) or die ('Sorry, looks
6
3779
by: redog6 | last post by:
Hi I have a webform with many free text fields and have a problem with apostrophes and single quotes as this breaks the mysql query string. I obviously need to escape these characters - magic_quotes_gpc sounds ideal but is not an option as I don't have access to the php.ini file and it is currently set to 0. I could use either addslashes or mysql_real_espcape_string but do I have to apply this to every field individually or is there a...
13
3489
by: ndlarsen | last post by:
Hello. It's been a while since I used php. Since then magic quotes has been deprecated and will be removed when php 6.0 hits. My question is, what should I be using when submitting data to a database instead? Which is better for security reasons, addslashes() or mygql_real_escape_string()? Thanks you. Regards
5
1829
by: Mandragon03 | last post by:
I am using mysql_real_escape_string for the input of a form before it is updated into the mysql database. Somthing like this: $realHTMLText = mysql_real_escape_string($_POST); $id = intval($_POST); $UpdateString = "UPDATE table SET Content = '$realHTMLText' where ID = $id"; This is on a form that allows you to edit the textarea. The problem I
7
5166
by: roseple | last post by:
Hi, can anyone please help me why I got this error every I uploaded files. Error: Here is the code on the said warning message: # Gather all required data $name = mysql_real_escape_string($dbLink, $_FILES); $mime = mysql_real_escape_string($dbLink, $_FILES); $size = $_FILES;
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10410
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9984
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.