PDA

View Full Version : Plase help me, I tired about it!



nina
05-13-2008, 11:34 AM
Please help me, I'm trying but not success.:(

I addon a domain name and made a sub folder inside.

subdomain --name is visa--for my website and set ftp. for upload files.

and I add mysql database 1 account. --name of my database is joy--

and I have make a file for test.--xxxx.php--
my code is:

<?php
function connOpen(){
$host="xx.xxx.xxx.xxx";
$username="username";
$password="password";
$conn=mysql_connect($host,$username,$password);
if(!$conn){
echo "connection accomplete";
}else{

mysql_select_db("myhomedirectory_dbjoy");
echo "connection complete";
}
}
function connClose(){
mysql_close();
}
function access_permit(){

}
function servermappath(){
return realpath("/");
}
connOpen();
?>

After then I upload file xxxx.php by ftp program.
I upload it to sub domain name is visa

After then I test open file in my website is http://visa.mydomainname.com/xxxx.php

then I find this messege
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'joy'@'hostxxx.hostmonster.com' (using password: YES) in /home/myhomedirectory/public_html/myaddondomain/visa/constant.php on line 6
connection accomplete

Thank you for your time.
Nina:(

nina
05-13-2008, 12:56 PM
I check many times, my username and password correct.

Thank you.
Nina

Speedy_B
05-13-2008, 03:31 PM
Hey...you need to use localhost to connect to the database, and you need to remove that username and password from the post here. Security issue.

So the code will be

$host="localhost";

nina
05-14-2008, 08:39 AM
Hey...I'm very glad:D , Thank you so much Speedy_B. It's working now after I change code to be

Quote:
$host="localhost";