我想更改我的数据库表时间列中的日期格式,我起诉了这段代码,但没有生效!我用代码试过了,但没有用!日期编辑的部分是$date = "SELECT DATE_FORMAT(time, '%m/%d/%Y %H:%i') FROM climate";这是我的完整代码: $conn = mysqli_connect($servername, $username, $password, $database); // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } echo "Connected successfully"; $sql = "INSERT INTO climate (temp, hum, time) VALUES ('$temp', '$hum', '$time')"; $date = "SELECT DATE_FORMAT(time, '%m/%d/%Y %H:%i') FROM climate";if (mysqli_query($conn, $date)) {// output data of each row echo "OK"; } else { echo "0 results"; }if (mysqli_query($conn, $sql)) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn); }
1 回答
- 1 回答
- 0 关注
- 110 浏览
添加回答
举报
0/150
提交
取消