A connection between PHP and your MariaDB database with one.com lets you interact with your database, allowing you to read and write data directly from your website.
To create this connection, you'll need the following information:
- Hostname
- Database name
- Username
- Password - If needed, you can read here how to update the password for your database.
Here is an example of a connection string using mysqli_connect:
$con=mysqli_connect("hostname", "database_username", "password", "database_name");
Remember to replace the placeholders with the details for your domain.
You can find the specific details for the database on your domain in the one.com Control Panel. In the Advanced settings tile, you choose PHP and database settings. From here you can also access your database(s).
Note: You can only make a connection to the database when your website is hosted on our servers.
Related articles: