我做错了什么,日期时间字段没有更新,而是值变成了全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());
使用以下代码
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());