Database Connectivity
1, create a new conn.inc.php file:
Define the database connection constants as follows:
<?php define("HOST",'localhost'); define("USER",'root'); define("PWD",'root'); define("DBNAME",'onecms');
2, create a new mysqli.php file:
<?php include 'conn.inc.php'; $mysqli=new mysqli(HOST,USER,PWD,DBNAME); if($mysqli->connect_errno){ die('数据库链接出错'.$mysqli->connect_error); }
You only need to introduce the mysqli.php file for the next database connection operation