Can't use mysql_real_escape_string

sendog

New Member
So, I'm getting this warning when using mysql_real_escape_string\[code\]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\[/code\]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:\[code\]function sani($string){ $string = strip_tags($string); $string = htmlspecialchars($string); $string = trim(rtrim(ltrim($string))); $string = mysql_real_escape_string($string); return $string;}\[/code\]And I use this function every time I do queries...\[code\]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);}\[/code\]Thanks on beforehand!
 
Back
Top