nahid079 Posted February 22, 2009 Share Posted February 22, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/146306-where-i-am-doing-wrong/ Share on other sites More sharing options...
djjamiegee Posted February 22, 2009 Share Posted February 22, 2009 //connect to mysql //change user and password to your mySQL name and password mysql_connect("hostname","db_name","db_password"); //select which database you want to edit mysql_select_db("db_name"); thats how i connect to mine jamie Quote Link to comment https://forums.phpfreaks.com/topic/146306-where-i-am-doing-wrong/#findComment-768116 Share on other sites More sharing options...
dropfaith Posted February 22, 2009 Share Posted February 22, 2009 <?php $host = "HOST"; $user = "USERNAME"; $pass = "pASSWORD"; $db = "DATABASE_NAME"; // open database connection $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/146306-where-i-am-doing-wrong/#findComment-768119 Share on other sites More sharing options...
Cosizzle Posted February 22, 2009 Share Posted February 22, 2009 I THINK ITS DREAMWEAVER. sorry caps Quote Link to comment https://forums.phpfreaks.com/topic/146306-where-i-am-doing-wrong/#findComment-768146 Share on other sites More sharing options...
blueman378 Posted February 22, 2009 Share Posted February 22, 2009 if your connecting with dreamweaver its considered a remote connection, (unless its your localhost) try checking with your hosting company to see if remote connections are enabled. Quote Link to comment https://forums.phpfreaks.com/topic/146306-where-i-am-doing-wrong/#findComment-768188 Share on other sites More sharing options...
nahid079 Posted February 22, 2009 Author Share Posted February 22, 2009 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???????? I have checked with my host, they are okay.....I have also checked with 4 other servers, still getting the same msg... however, I did try to connect with the following code (didn't work & still doesn't work): <!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> Quote Link to comment https://forums.phpfreaks.com/topic/146306-where-i-am-doing-wrong/#findComment-768237 Share on other sites More sharing options...
nahid079 Posted February 22, 2009 Author Share Posted February 22, 2009 hey guys...I have managed to crack the deal...I had to use Remote view instead of Local view to see it connected....thanks Quote Link to comment https://forums.phpfreaks.com/topic/146306-where-i-am-doing-wrong/#findComment-768246 Share on other sites More sharing options...
blueman378 Posted February 22, 2009 Share Posted February 22, 2009 knoew it was something to do with remote andway dont forget to mark the topic as solved. Quote Link to comment https://forums.phpfreaks.com/topic/146306-where-i-am-doing-wrong/#findComment-768276 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.