I am trying to get this function to work and having a few problems.

if(function_exists("mysql_real_escape_string"))
{
       $value = mysql_real_escape_string( $value );
}

and i get an error:

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in w:\pathname on line 11

Does anyone know how to resolve this? I'm using Uniform Server under XP Home.

Recommended Answers

All 2 Replies

You have to establish a connection to mysql before trying to use that function.

$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password');
if(function_exists("mysql_real_escape_string"))
{
       $value = mysql_real_escape_string( $value );
}

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.