php mysql_real_escape_string error

hi there,
i have been building a site on my mac with xampp. now that i have uploaded it to my host, i am getting the following errors where i am santising data for entry into the database:

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'vu2049'@'localhost' (using password: NO) in /var/www/virtual/  on line 7

the code that is causing the error is:

      $contactname = $_POST['contact'];
      $contactname = mysql_real_escape_string($contactname);

i have tried to run a phpinfo() on the host but it seems to be disabled by them, how else can i see which version of php they are using?

is this likely to be a sitting in the conf file?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I don't think the error is related to mysql-real-escape-string function it has more to do with the fact that you are not connected properly: Access denied for user 'vu2049'@'localhost' (using password: NO)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
alexanderfotiAuthor Commented:
you're right, the db connection script was using old credentials.

Make sure that you are connecting to your MySQL database before running that command. Do you have a couple lines of code before line 7 that look similar to this?

$link = mysql_connect('localhost', 'root', '') or die                      ('Error connecting to mysql');


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.