So, I'm getting this warning when using mysql_real_escape_string
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'username'@'localhost' (using password: NO) in /home/path/php/functions.php on line 11
The rest of the site works fine, connects to the DB and all, but I get an error when using this function.
It works completely fine on my localhost testing server.
Any ideas?
I use aforementioned function in my own homebrew string sanitation function:
function sani($string){
$string = strip_tags($string);
$string = htmlspecialchars($string);
$string = trim(rtrim(ltrim($string)));
$string = mysql_real_escape_string($string);
return $string;
}
And I use this function every time I do queries...
function mm_mysqlquery($query) {
if (MM_DEBUG == true) { echo "Query: $query <br>"; mm_log("Query: $query"); } //print query if MM_DEBUG
$link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die ("mysql_error: " . mysql_error());
$db_selected = mysql_select_db(DB_NAME);
return mysql_query($query, $link);
}
Thanks on beforehand!