什么是我做错了,datetime字段没有得到更新,而是值变为全0
echo print_r($_POST);;
$time_in = $_POST['time_in'];
$time_out = $_POST['time_out'];
$id = $_GET['id'];
echo $sql = "UPDATE hours SET time_in = '".$time_in."' AND time_out = '".$time_out."' WHERE id = '".$id."'";
mysql_query($sql) or die(mysql_error());
答案 0 :(得分:-1)
使用以下代码
echo print_r($_POST);;
$time_in = date('Y-m-d H:i:s',strtotime($_POST['time_in']));
$time_out = date('Y-m-d H:i:s',strtotime($_POST['time_out']));
$id = $_GET['id'];
echo $sql = "UPDATE hours SET time_in = '".$time_in."', time_out = '".$time_out."' WHERE id = '".$id."'";
mysql_query($sql) or die(mysql_error());