0
我下面的查詢該更新db表停車場到列名:緯度,經度,parking_time和let_parked。因此,它將更新所有列,但它不會更新NOW()的parking_time列。你知道爲什麼嗎 ?Mysql的NOW()不更新數據庫
if(isset($_POST["update"]) && $_POST["update"]==true)
{
if($userid == "1")
{
$parking_time = "(NOW() - INTERVAL 122 MINUTE)";
$results = $mysqli->query("UPDATE parkings SET latitude = '$mLat', longitude = '$mLng', parking_time = '$parking_time', let_parked = '1' WHERE locId = '$mId' ");
}
elseif($userid == '0')
{
$parking_time = "NOW() - INTERVAL 220 MINUTE";
$results = $mysqli->query("UPDATE parkings SET latitude = '$mLat', longitude = '$mLng', parking_time = '$parking_time' WHERE locId = '$mId' ");
}
if (!$results) {
//header('HTTP/1.1 500 Error: Could not Update Markers! $mId');
echo "coudld not update marker." . mysql_error();
exit();
}
exit("Updated successfully Done! $userid, $mId");
}
取出單引號''parking_time''到'$ parking_time' –
@JorgeCampos它的工作。謝謝。 – Alex