Author Topic: How to connect to other website from website i'm using  (Read 1301 times)

0 Members and 1 Guest are viewing this topic.

Offline ron814Topic starter

  • Irregular
  • Posts: 7
    • View Profile
How to connect to other website from website i'm using
« on: August 16, 2010, 04:30:32 AM »
I tried to connect to other website and my code below are :

$host = "$hostname";
$mysqlusername = "$username";
$mysqlpassword = "$password";
$mysqldatabase = "$mydatabase";
$mysqlconnection = mysql_connect($hostname,$mysqlusername,$mysqlpassword);
mysql_select_db($mysqldatabase,$mysqlconnection);

of course i supplied the right host name, username and password but still  an error occur :
Warning: mysql_connect() [function.mysql-connect]: Access denied for user '$username'@'$hostname' (using password: YES) in /home/public_html/test_directory/sampleFile.php on line 7

Is there someone who could help me to solve, I would be greatful for your help.


« Last Edit: August 16, 2010, 04:32:29 AM by ron814 »

Offline thorpe

  • Administrator
  • 'Mind Boggling!'
  • *
  • Posts: 29,255
    • View Profile
Re: How to connect to other website from website i'm using
« Reply #1 on: August 16, 2010, 04:38:16 AM »
You need to make sure your user has permissions to connect from the remote host. its all covered in the manual.

http://dev.mysql.com/doc/refman/5.1/en/adding-users.html

Offline ron814Topic starter

  • Irregular
  • Posts: 7
    • View Profile
Re: How to connect to other website from website i'm using
« Reply #2 on: August 16, 2010, 04:44:06 AM »
And I already added the user to the database but same error occurs.

I tried to connect to other website and my code below are :

$host = "$hostname";
$mysqlusername = "$username";
$mysqlpassword = "$password";
$mysqldatabase = "$mydatabase";
$mysqlconnection = mysql_connect($hostname,$mysqlusername,$mysqlpassword);
mysql_select_db($mysqldatabase,$mysqlconnection);

of course i supplied the right host name, username and password but still  an error occur :
Warning: mysql_connect() [function.mysql-connect]: Access denied for user '$username'@'$hostname' (using password: YES) in /home/public_html/test_directory/sampleFile.php on line 7

Is there someone who could help me to solve, I would be greatful for your help.
« Last Edit: August 16, 2010, 04:51:27 AM by ron814 »

Offline thorpe

  • Administrator
  • 'Mind Boggling!'
  • *
  • Posts: 29,255
    • View Profile
Re: How to connect to other website from website i'm using
« Reply #3 on: August 16, 2010, 05:22:24 AM »
Post your exact code. It looks like (I should have noticed this within your first post) $username & $hostname are literally being passed to mysql_connect.