Rifts Posted February 22, 2010 Share Posted February 22, 2010 Hey im trying to test my pages before I put them live, I'm sure wampserver and im trying to connect to my mysql database and then list the table. here is the error im getting along with the page code. thanks! Warning: mysql_connect() [function.mysql-connect]: php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\wamp\www\php\phppull.php on line 7 Warning: mysql_connect() [function.mysql-connect]: [2002] php_network_getaddresses: getaddrinfo failed: No such host is kn (trying to connect via tcp://http:0) in C:\wamp\www\php\phppull.php on line 7 Warning: mysql_connect() [function.mysql-connect]: php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\wamp\www\php\phppull.php on line 7 Could not connect: php_network_getaddresses: getaddrinfo failed: No such host is known. and the site code <html> <body> <?php $con = mysql_connect("databasesite.com","xxxxxx","xxxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("lms", $con); $result = mysql_query("SELECT * FROM degreetype"); while($row = mysql_fetch_array($result)) { echo $row['DegreeTypeID'] . " " . $row['DegreeType']; echo "<br />"; } mysql_close($con); ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
xoligy Posted February 22, 2010 Share Posted February 22, 2010 If its a homeserver its normally something like this: $con = mysql_connect("localhost","username","password"); Quote Link to comment Share on other sites More sharing options...
manohoo Posted February 22, 2010 Share Posted February 22, 2010 It seems that "database.com" resides in a remote server... does the connection require a specific port? If so, the port needs to be specified in the connection. Quote Link to comment Share on other sites More sharing options...
Rifts Posted February 22, 2010 Author Share Posted February 22, 2010 no it's not a homeserver its hosted through a hosting company. oohh a port, that is a good idea ill look into it Quote Link to comment Share on other sites More sharing options...
schilly Posted February 22, 2010 Share Posted February 22, 2010 most mysql configs have external db connections turned off by default. Quote Link to comment 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.