【发布时间】:2017-05-21 08:34:19
【问题描述】:
我正在尝试在我的一个查询中使用时间函数...我有如下查询,用于在我的一个 DATETIME 字段中添加自定义时区时间。
$upd_qry = "update tbl_quotes
set qu_status='".$_GET['status']."', qu_time= $getDatetimeNow
where _quid='".$_GET['quotes_id']."'";
$result=mysqli_query($mysqli,$upd_qry);
使用自定义时区获取时间的函数如下所示
function getDatetimeNow() {
$tz_object = new DateTimeZone('Brazil/East');
//date_default_timezone_set('Brazil/East');
$datetime = new DateTime();
$datetime->setTimezone($tz_object);
return $datetime->format('Y\-m\-d\ h:i:s');
}
但我的查询不起作用...这有什么问题?
谢谢
【问题讨论】:
-
将查询添加到隐藏的 html 元素,如 使用 jquery 调用元素
-
查看参数化查询