search
  • Sign In
  • Sign Up
Password reset successful

Follow the proiects vou are interested in andi aet the latestnews about them taster

Database file configuration of php development message board

Connecting to the database

Writing ideas

QQ截图20161130140327.png

Create a new file conn.php to set up the connection database file

<?php
 $conn =mysql_connect("localhost", "root", "123456789") or die("数据库链接错误");
 mysql_select_db("bbs", $conn);
 mysql_query("set names 'utf8'"); //使用utf-8中文编码;
 ?>

root fill in the user name of mysql 123456789 can fill in your own database password

or die("Database link error"); Make a judgment

mysql_select_db("bbs", $conn);
Fill in the name of the table in your own database at the position of bbs

The file requires a database connection. You only need to call the conn.php file to use it, which is very convenient.

new file
<?php $conn =mysql_connect("localhost", "root", "123456789") or die("数据库链接错误"); mysql_select_db("bbs", $conn); mysql_query("set names 'utf8'"); //使用utf-8中文编码; ?>
Reset Code
Automatic operation
submit
Preview Clear