<?php $servername = "localhost"; $username = "root"; $password = "root"; $dbname = "qingjia"; // 创建连接 $conn = new mysqli($servername, $username, $password, $dbname); // 检测连接 if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql="INSERT INTO qingjiabiao set id='$_POST[id]',name='$_POST[name]',classid='$_POST[classid]',qjtime='$_POST[qjtime]',qjsc='$_POST[qjsc]',yuanyin='$_POST[yuanyin]' " ; if ($conn->query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . $conn->error; } $conn->close(); ?>
如何设置成UTF8的字符插入