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/domain.com/htdocs/logcall.php  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?
LVL 1
alexanderfotiAsked:
Who is Participating?
 
gamebitsConnect With a Mentor Commented:
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)
0
 
alexanderfotiAuthor Commented:
you're right, the db connection script was using old credentials.

thanks!
0
 
omniumnetworkingCommented:
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');

mysql_select_db(''my_database_name');

0
All Courses

From novice to tech pro — start learning today.