ch4rlie Posted December 6, 2014 Share Posted December 6, 2014 I have a db.php and inside it I filled out all the info needed: <?php define('DB_HOST', 'example.com'); define('DB_NAME', 'database_name'); define('DB_USERNAME', 'user_name'); define('DB_PASSWORD', '*******'); $odb = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USERNAME, DB_PASSWORD); ?> My problem is with the DB_HOST, is that my direct URL to the site? for example, google.com or is it like an IP? Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted December 6, 2014 Share Posted December 6, 2014 The only time you need to specify the hostname as a domain name is if your are connecting to it remotely. In most cases setting it localhost will be just fine. Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted December 6, 2014 Share Posted December 6, 2014 is that my direct URL to the site? no. and in the cases where you do specify a url (that resolves to the ip of the database server), it would be the url of the database server, not the url of a web server. typical urls would be something like mysql1.example.com. if you are having a problem on your hosting connecting to the correct database server for you account, you can find the correct hostname to use from your web host and it is also typically displayed on the page (phpmyadmin) where you created your databases/database tables. 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.