Php database connection method. Php Tutorial database tutorial connection method * databaseconfig * $ db_hostlocalhost; $ db_userroot; $ db_pass123; $ db_databasetodo; * endconfig * $ link @ mysql tutorial _ co php Tutorial database tutorial connection method
/* Database config */
$ Db_host = 'localhost ';
$ Db_user = 'root ';
$ Db_pass = '123 ';
$ Db_database = 'Todo ';
/* End config */
$ Link = @ mysql tutorial _ connect ($ db_host, $ db_user, $ db_pass) or die ('unable to establish a db connection ');
Mysql_set_charset ('utf8 ');
Mysql_select_db ($ db_database, $ link );
// Database Connection Code 2
Error_reporting (e_all ^ e_notice );
$ Db_host = '';
$ Db_user = '';
$ Db_pass = '';
$ Db_name = '';
@ $ Mysqli = new mysqli ($ db_host, $ db_user, $ db_pass, $ db_name );
If (mysqli_connect_errno ()){
Die ('could not connect to the databaseplease try again after a few moments .');
}
$ Mysqli-> set_charset ("utf8 ");
Database tutorial connection method/* database config */$ db_host = 'localhost'; $ db_user = 'root'; $ db_pass = '2013'; $ db_database = 'Todo '; /* end config */$ link = @ mysql tutorial _ co...