1. Copy the php_mysql.dll file in the PHP installation directory and the libmysql.dll file in the MySQL installation directory to c:/windows/system32;
2. Configure php.ini
extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_mysqli.dll
1. login.php page
<span style="font-size:14px;"><html> <title>login page</title> <body> </body> </html></span>
<span style="font-size:14px;"><?php include("conn.php"); ?> <?php if(isset($_POST["submit"])) { $sql = "insert into users(username, email) values('$_POST[username]', '$_POST[email]')"; mysqli_query($conn, $sql); echo "添加成功"; } ?></span>
<span style="font-size:14px;"><?php $conn = new mysqli("localhost", "root", "159357"); $conn->select_db("db_test"); //mysql_query("set name 'gb2312'"); $conn->set_charset("utf8"); ?></span>