Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied

1,149 views
Skip to first unread message

ptrane

unread,
Jul 13, 2009, 5:50:37 PM7/13/09
to Php Object Generator
Here is the full error message i receive after entering my form:
Warning: mysql_real_escape_string() [function.mysql-real-escape-
string]: Access denied for user 'SYSTEM'@'localhost' (using password:
NO) in C:\wamp\www\pog\wff\objects\class.pog_base.php on line 59

The form was generated using web form factory. When I submit the form
it says the data was inserted but actually nothing was written to the
database. Any help would be great.

Thanks,

Pino

Mario

unread,
Jul 20, 2009, 2:13:55 AM7/20/09
to Php-Object...@googlegroups.com
It seems no connection to the database has been created.
Have you set properly the fields of the "configuration.php" file?

If you already had, you may want to create a connection by yourself.
Check the mysql_connect function and call it before using mysql_real_escape_string.

If you are using POG you'd better read the generated code and realize it will
call mysql_real_escape_string by itself, there's no need for you to do it.


Have a nice day

2009/7/13 ptrane <ptra...@gmail.com>



--
The most likely way for the world to be destroyed, most experts agree, is by accident.
That's where we come in; we're computer professionals.
We cause accidents.
(Nathaniel Borenstein)

Lynn Kasdorf

unread,
Jul 20, 2009, 2:27:09 PM7/20/09
to Php Object Generator
This has been an issue for quite a while now, and I don't know what
the proper resolution is.
HOWEVER- the simple work-around is this:
change Line 59 in objects/pog_base.php from:
return mysql_real_escape_string($text);
to:
return addslashes($text);

This will put you back in business.

Joel- how can we prevent this from happening?

Joel Wan

unread,
Jul 20, 2009, 2:33:34 PM7/20/09
to Php Object Generator
I can investigate. I can also change the default pog_base generated so
that line 59 says addslashes in the meantime. Thanks for bringing this
to my attention.

Dirk Martin

unread,
Jul 20, 2009, 2:50:46 PM7/20/09
to Php-Object...@googlegroups.com
In pdo there is a method called "quote" which can be used instead of
mysql_real_escape_string():

$db->quote($text);

This is better than addslashes() I think. But how to check whether or
not pdo is used?

Joel Wan

unread,
Jul 20, 2009, 2:54:07 PM7/20/09
to Php Object Generator
We can control this on our end when the code is generated with PDO, we
can generate a different pog_base that uses quote instead of
addslashes. thx for the suggestion
Reply all
Reply to author
Forward
0 new messages