New conn.inc.php file
The code is as follows:
<?php define("HOST",'localhost'); define("USER",'root'); define("PWD",'root'); define("DBNAME",'php');
New msyqli.php file
The code is as follows:
<?php include 'conn.inc.php'; $mysqli=new mysqli(HOST,USER,PWD,DBNAME); if($mysqli->connect_errno){ die('数据库链接出错'.$mysqli->connect_error); }
When you need to use a database connection, you only need to import the msyqli.php file
Next Section