change escaping function as the mysql_real_escape_string does not work correctly without mysql connection.