开发者

Connecting to MySQL-database

开发者 https://www.devze.com 2023-01-24 09:53 出处:网络
I\'m creating a WWW-page in开发者_如何学Go 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

I'm creating a WWW-page in开发者_如何学Go 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'?


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消