samedi 28 octobre 2017

Connecting to a database from a web server

Not sure if this is possible in the way I originally thought it was, but i'm trying to connect a web page to a sql file stored on the same web server. I first had the database set up on my own computer, with the following credentials.

   define('DB_SERVER', 'localhost:3306');
   define('DB_USERNAME', 'root');
   define('DB_PASSWORD', '');
   define('DB_DATABASE', 'test');
   $db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);

This connection worked and I got everything working locally. When I try to use this code after transferring everything to the web server, I get an error. I assumed it was with the credentials, so I've tried changing the above values to match the web server address, as well as the user login for the web server, with no luck. Not quite sure what else to try, or if this can be done. Also unsure of how to put the database on a database server and how to connect to that, if that's what I need to do.




Aucun commentaire:

Enregistrer un commentaire