fortnox007 Posted January 20, 2011 Share Posted January 20, 2011 Hi all I was trying to connect to a database which is running on an external host. So i thought i try the stuff below. That didn't work. Is it possible that the host has disabled external connection or something? I tried to add http:// before the domain, but no succes either <?php $dbc = mysqli_connect('db87654321.somedomain.com','user','pass','database')// this is line 5 or die(mysqli_error($dbc)); echo 'connected'; ?> it gave the following error: Warning: mysqli_connect() [function.mysqli-connect]: (HY000/2005): Unknown MySQL server host 'db87654321.somedomain.com' (11004) in H:\xampp\htdocs\databasetestfile.php on line 5 P.s. the script worked when upload to the server. P.p.s is there something i should be carefull with when connection to an external database? Link to comment https://forums.phpfreaks.com/topic/225040-mysqli-connect-file-works-when-uploaded-but-not-local-any-ideas/ Share on other sites More sharing options...
Pikachu2000 Posted January 20, 2011 Share Posted January 20, 2011 It's actually very likely that the host has disallowed external connections. Link to comment https://forums.phpfreaks.com/topic/225040-mysqli-connect-file-works-when-uploaded-but-not-local-any-ideas/#findComment-1162305 Share on other sites More sharing options...
fortnox007 Posted January 20, 2011 Author Share Posted January 20, 2011 Ok that's good to know, Ill ask them when they are awake. May i assume that it would be insecure to use an external database? Or are there any drawbacks? Link to comment https://forums.phpfreaks.com/topic/225040-mysqli-connect-file-works-when-uploaded-but-not-local-any-ideas/#findComment-1162318 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.