ron814 Posted August 16, 2010 Share Posted August 16, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/210834-how-to-connect-to-other-website-from-website-im-using/ Share on other sites More sharing options...
trq Posted August 16, 2010 Share Posted August 16, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/210834-how-to-connect-to-other-website-from-website-im-using/#findComment-1099745 Share on other sites More sharing options...
ron814 Posted August 16, 2010 Author Share Posted August 16, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/210834-how-to-connect-to-other-website-from-website-im-using/#findComment-1099748 Share on other sites More sharing options...
trq Posted August 16, 2010 Share Posted August 16, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/210834-how-to-connect-to-other-website-from-website-im-using/#findComment-1099760 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.