where I am doing wrong????

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
nahid079
Forum Newbie
Posts: 4
Joined: Sat Feb 21, 2009 7:06 pm

where I am doing wrong????

Post by nahid079 »

MySQL Host=mysql3.000webhost.com
MySQL Database = a9230817_test
MySQL User = a9230817_nahid
password = ***********

while I am trying to connect to my Database through DREAMEAVER, I am getting the following message -

" an unidentified error has occured"..........................................DO YOU KNOW WHY??????????????

Please help


Kind regards,

Saif
wpsd2006
Forum Commoner
Posts: 66
Joined: Wed Jan 07, 2009 12:43 am

Re: where I am doing wrong????

Post by wpsd2006 »

can you give the full code
oh and you should censor your sql username and password even the host
or you will get hacked
nahid079
Forum Newbie
Posts: 4
Joined: Sat Feb 21, 2009 7:06 pm

Re: where I am doing wrong????

Post by nahid079 »

you know when you try to connect through Dreamweaver, you dont really need any code first. you have to just connect, ain;t I right????????

however, I have also tried with the following code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?
// hostname or ip of server
$servername='mysql3.000webhost.com';

// username and password to log onto db server
$dbusername='a9230817_nahid';
$dbpassword='********';

// name of database
$dbname='a9230817_test';

////////////// Do not edit below/////////

connecttodb($servername,$dbname,$dbusername,$dbpassword);
function connecttodb($servername,$dbname,$dbuser,$dbpassword)
{
global $link;
$link=mysql_connect ("$servername","$dbuser","$dbpassword");
if(!$link){die("Could not connect to MySQL");}
mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error());
}
?>
</body>
</html>
wpsd2006 wrote:can you give the full code
oh and you should censor your sql username and password even the host
or you will get hacked
User avatar
LanceEh
Forum Commoner
Posts: 46
Joined: Tue Feb 17, 2009 11:53 am
Location: Florida

Re: where I am doing wrong????

Post by LanceEh »

Make sure all your info is right. (check with your host)

God bless.
nahid079
Forum Newbie
Posts: 4
Joined: Sat Feb 21, 2009 7:06 pm

Re: where I am doing wrong????

Post by nahid079 »

I have already done it..

I have also checked with 4 other servers and still getting the same error msg....

any idea??????????
nahid079
Forum Newbie
Posts: 4
Joined: Sat Feb 21, 2009 7:06 pm

Re: where I am doing wrong????

Post by nahid079 »

hey guys...I have managed to crack the deal...I had to use Remote view instead of Local view to see it connected....thanks
Post Reply