php failed to connect to the database server?
conn.php代码如下: <?php //连接MySQL服务器,选择数据库 $conn=mysqli_connect("localhost", "root", "root", "cloth_system") or die("连接数据库服务器失败!".mysqli_error()); //设置数据库编码格式utf8 mysqli_query($conn,"set names utf8"); ?> index.php代码如下: ...... <!--top--> <!--main--> <?php include_once("conn/conn.php"); //连接到数据库 ?>
Solution:
Run conn.php directly to see the error message, and then make corresponding modifications based on the error message.
For more PHP related knowledge, please visit PHP Chinese website!
The above is the detailed content of PHP failed to connect to database server. For more information, please follow other related articles on the PHP Chinese website!