我已多次尝试解决此问题,而且我未能更新我已控制的较旧网页上的代码。
我有一些代码(是的,我知道我还在使用mysql,但它是一个旧页面,我没有时间为mysqli重写所有内容那一刻)。
代码:
<?php
mysql_connect("some hostname", "someusername", "somepassword") or
die(mysql_error());
mysql_select_db("somedatabase") or die(mysql_error());
$id = (int)$_GET['id'];
mysql_query("SET CHARACTER SET 'utf8';");//GET and POST
mysql_query("SET NAMES 'utf8';");//POST
$order = " SELECT *
FROM tbl_patientdoseinformation
WHERE patientdoseID = '$id'";
$result = mysql_query($order);
$datetimestated = date('Y-m-d\TH:i:s', strtotime($row['datetimestated']));
$row = mysql_fetch_array($result);
?>
以及输入代码为
的表单 <input type="datetime-local" name="stated" value="<?php echo $datetimestated; ?>">
然而,当它回声时,肯定不是数据库中的日期/时间。
I&#34; m记录的值应该是 07/20/2016 10:00 AM
回声的价值是: 12/31/1969 06:00 PM
答案 0 :(得分:0)
您尝试在从结果集
中检索$row
之前使用<?php
mysql_connect("some hostname", "someusername", "somepassword") or
die(mysql_error());
mysql_select_db("somedatabase") or die(mysql_error());
$id = (int)$_GET['id'];
mysql_query("SET CHARACTER SET 'utf8';");//GET and POST
mysql_query("SET NAMES 'utf8';");//POST
$order = " SELECT *
FROM tbl_patientdoseinformation
WHERE patientdoseID = '$id'";
$result = mysql_query($order);
$row = mysql_fetch_array($result);
// move to after the fetch
$datetimestated = date('Y-m-d\TH:i:s', strtotime($row['datetimestated']));
?>
enum Type {This, That }
fn match_it(t: Type, b: Box<Object>) {
let p = match t {
Type::This => mem::transmute::<Box<Object>, Box<This>>(b),
Type::That => mem::transmute::<Box<Object>, Box<That>>(b),
}
}