Connecting to MySQL-database

I'm creating a WWW-page in www.freehostingcloud.com. I created a database of the name sample. But how can I connect to it in MySQL and PHP? I saw from PHP.net that I should type

mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db');

OK, so my_db=sample but what are those parameters 'localhost', 'my_user' and 'my_password'?

Upvotes: 0

Views: 202

Answers (2)

Alan Haggai Alavi
Alan Haggai Alavi

Reputation: 74222

They are documented in the Parameters section of mysqli::__construct().

Upvotes: 0

meder omuraliev
meder omuraliev

Reputation: 186562

They are the host, username and password required to access your database. Localhost means your computer aka 127.0.0.1, the others are the users you create in your local db.

Upvotes: 1

Related Questions