给SQL插入当前时间
<?php //获取数据 $name = $_GET[‘name‘]; $servername = "localhost"; //服务器名 $username = "aaa"; //用户名 $password = "aaa"; //用户密码 $dbname = "bbb"; //数据库名 // 创建连接 $conn = new mysqli($servername, $username, $password, $dbname); // 检测连接 if ($conn->connect_error) { die("连接失败: " . $conn->connect_error); } $sql = "INSERT INTO user (name,time) VALUES (‘$name‘,now())"; if ($conn->query($sql) === TRUE) { echo "新记录插入成功"; } else { echo "Error: " . $sql . "<br>" . $conn->error; } //断开连接 $conn->close(); ?>
红色部分根据实际情况修改
相关推荐
bleach00 2020-11-10
lmllouk 2020-11-02
一片荷叶 2020-10-28
jiong 2020-10-31
Youda 2020-08-29
thunderstorm 2020-08-19
guodaoying 2020-08-16
whyname 2020-08-16
zjyzz 2020-08-16
nan00zzu 2020-08-08
zyjj 2020-07-26
xwb 2020-07-19
云之飞踢 2020-07-08
chenjiazhu 2020-07-08
明月清风精进不止 2020-07-05
URML 2020-07-04