PHP Tutorial Database Tutorial How to connect
/* 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 Two
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 database
Please try again after a few moments.
');
}
$mysqli->set_charset ("UTF8");
http://www.bkjia.com/PHPjc/630799.html www.bkjia.com true http://www.bkjia.com/PHPjc/630799.html techarticle PHP Tutorial Database Tutorial How-to Connection method/*/$db _host= ' localhost '; $db _user= ' root '; $db _pass= ' 123 '; $db _database= ' Todo '; /* End config */$link = @mysql Tutorial _co ...