Database file configuration of php development message board
Connecting to the database
Writing ideas
Create a new file conn.php to set up the connection database file
<?php $conn =mysql_connect("localhost", "root", "123456789") or die("數(shù)據(jù)庫鏈接錯(cuò)誤"); 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.