How to connect PHP to your database

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:

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).

Database Technical information.png

Note: You can only make a connection to the database when your website is hosted on our servers.

Related articles:

Was this article helpful?

Can’t find what you are looking for?

Start a chat

It's the quickest way to get in touch, every day of the year.

Give us a call

Available on weekdays from 10am to 2pm (UTC).